Skip to content

帮助您快速在MySQL\MariaDB上实现日志系统的框架

License

Notifications You must be signed in to change notification settings

HankXV/Recorder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

什么是Recorder?

主要用于在游戏中记录日志或者流水(比如货币的花销流水,任务的完成日志),方便后台统计和查询。此框架目前只适用于数据库 MySQL\MariaDB

快速开始

Maven
<dependency>
    <groupId>org.slingerxv</groupId>
    <artifactId>recorder</artifactId>
    <version>2.0-alpha</version>
</dependency>
Gradle
compile 'org.slingerxv:recorder:2.0-alpha'

建立一个日志的Bean

	public class UserLog extends TimeBasedLog {
		@Col(type = SQLType.VARCHAR, size = 255, comment = "user name")
		public String name;
		@Col(comment = "user age")
		public int age;
		@Col(type = SQLType.VARCHAR, size = 255, comment = "user address")
		public String address;
	
		@Override
		public RollType rollType() {
			return RollType.DAY_ROLL;
		}
	}

初始化日志代理,并执行写入任务,完成!

	UserLog userLog = new UserLog();
	userLog.name="HankXV";
	userLog.age=101;
	userLog.address="home";
	new RecorderProxy
	.RecorderProxyBuilder()
	.dataSource(yourDatasource)
	.build()
	.startServer()
	.execute(userLog);
		

更新日志

v2.0-release
1.表检查器支持多表同Bean的检查(垂直分表),表名逗号隔开
v2.0-alpha
此版本为pre-release版本
1.减少了很多复杂的命名
2.日志Bean的字段从私有变为公有,操作更方便
3.增加查询日志的API
4.简化SQLType的名称

About

帮助您快速在MySQL\MariaDB上实现日志系统的框架

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages