Initialize ALog in your Application
masterInitialize ALog within the onCreate method of your Application class using the ALog.init(Context) method. This returns an ALog.Config object that allows you to configure various logging behaviors such as console output, file storage, and global tags.
// init it in ur application
public void initALog() {
ALog.Config config = ALog.init(this)
.setLogSwitch(BuildConfig.DEBUG)// Set total log switch (console + file)
.setConsoleSwitch(BuildConfig.DEBUG)// Set console output switch
.setGlobalTag(null)// Set global tag (null uses class name if no tag provided)
.setLogHeadSwitch(true)// Set log header switch
.setLog2FileSwitch(false)// Set log to file switch
.setDir("")// Set directory (defaults to /cache/log/ if empty)
.setFilePrefix("")// Set file prefix (defaults to "alog")
.setBorderSwitch(true)// Set border switch
.setSingleTagSwitch(true)// Set single tag switch for AS 3.1 Logcat
.setConsoleFilter(ALog.V)// Console filter (e.g., ALog.V)
.setFileFilter(ALog.V)// File filter
.setStackDeep(1)// Stack depth
.setStackOffset(0)// Stack offset
.setSaveDays(3)// Days to keep logs (-1 for infinite)
.addFormatter(new ALog.IFormatter<ArrayList>() {
@Override
public String format(ArrayList list) {
return "ALog Formatter ArrayList { " + list.toString() + " }";
}
});
ALog.d(config.toString());
}