主要用于在游戏中记录日志或者流水(比如货币的花销流水,任务的完成日志),方便后台统计和查询。此框架目前只适用于数据库 MySQL\MariaDB。
<dependency>
<groupId>org.slingerxv</groupId>
<artifactId>recorder</artifactId>
<version>2.0-alpha</version>
</dependency>
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);
1.表检查器支持多表同Bean的检查(垂直分表),表名逗号隔开
此版本为pre-release版本
1.减少了很多复杂的命名
2.日志Bean的字段从私有变为公有,操作更方便
3.增加查询日志的API
4.简化SQLType的名称