### Initialize ALog in Android Application Source: https://github.com/blankj/alog/blob/master/README.md Example of initializing the ALog library within an Android Application's `onCreate` method, demonstrating various configuration options such as log switch, console switch, global tag, log head switch, file logging, directory, file prefix, border, single tag, console/file filters, stack depth/offset, save days, and adding a custom formatter for ArrayList. ```Java // init it in ur application public void initALog() { ALog.Config config = ALog.init(this) .setLogSwitch(BuildConfig.DEBUG)// Set global log switch, including console and file output, default on .setConsoleSwitch(BuildConfig.DEBUG)// Set console output switch, default on .setGlobalTag(null)// Set global log tag, default empty // When global tag is not empty, all logs will use this tag. // If empty, and the passed tag is empty, it displays the class name; otherwise, it displays the passed tag. .setLogHeadSwitch(true)// Set log header info switch, default on .setLog2FileSwitch(false)// Set switch to save logs to file, default off .setDir("")// If custom path is empty, logs are written to /cache/log/ directory of the app .setFilePrefix("")// If file prefix is empty, defaults to "alog", e.g., "alog-MM-dd.txt" .setBorderSwitch(true)// Set log border display switch, default on .setSingleTagSwitch(true)// Set single log entry output, default on, for AS 3.1 Logcat beautification .setConsoleFilter(ALog.V)// Log console filter, similar to logcat filter, default Verbose .setFileFilter(ALog.V)// Log file filter, similar to logcat filter, default Verbose .setStackDeep(1)// Log stack depth, default 1 .setStackOffset(0)// Set stack offset, needed for secondary encapsulation, default 0 .setSaveDays(3)// Set log retention days, default -1 for infinite duration // Add ArrayList formatter, default support for Array, Throwable, Bundle, Intent formatting .addFormatter(new ALog.IFormatter() { @Override public String format(ArrayList list) { return "ALog Formatter ArrayList { " + list.toString() + " }"; } }); ALog.d(config.toString()); } ``` -------------------------------- ### ALog Class API Reference Source: https://github.com/blankj/alog/blob/master/README.md Comprehensive list of ALog class methods and their functionalities for logging, configuration, and formatting. ```APIDOC init : Initialize ALog library getConfig : Get current log configuration Config.setLogSwitch : Set global log switch (console and file output) Config.setConsoleSwitch : Set console log output switch Config.setGlobalTag : Set global log tag Config.setLogHeadSwitch : Set log header information switch Config.setLog2FileSwitch : Set log file output switch Config.setDir : Set log file storage directory Config.setFilePrefix : Set log file prefix Config.setBorderSwitch : Set log border display switch Config.setSingleTagSwitch: Set single tag output switch (for AS 3.1 Logcat beautification) Config.setConsoleFilter : Set log console filter Config.setFileFilter : Set log file filter Config.setStackDeep : Set log stack depth Config.setStackOffset : Set log stack offset Config.setSaveDays : Set log retention days Config.addFormatter : Add new log formatter log : Custom tag type log v : Verbose log with class name as tag vTag : Verbose log with custom tag d : Debug log with class name as tag dTag : Debug log with custom tag i : Info log with class name as tag iTag : Info log with custom tag w : Warn log with class name as tag wTag : Warn log with custom tag e : Error log with class name as tag eTag : Error log with custom tag a : Assert log with class name as tag aTag : Assert log with custom tag file : Log to file json : Log JSON string xml : Log XML string ``` -------------------------------- ### Add ALog Gradle Dependency Source: https://github.com/blankj/alog/blob/master/README.md Instructions to include the ALog library in an Android project's `build.gradle` file by adding the specified compile dependency. ```Gradle compile 'com.blankj:alog:1.9.1' ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.