/** * Initialize log system, should be called only once. * * @param logLevel the log level, logs with a lower level than which would not be printed * @param logConfiguration the log configuration * @deprecated the log level is part of log configuration now, use {@link #init(LogConfiguration)} * instead, since 1.3.0 */ @Deprecated public static void init(int logLevel, LogConfiguration logConfiguration) { init(new LogConfiguration.Builder(logConfiguration).logLevel(logLevel).build()); }
/** * Initialize log system, should be called only once. * * @param logLevel the log level, logs with a lower level than which would not be printed * @param logConfiguration the log configuration * @param printers the printers, each log would be printed by all of the printers * @deprecated the log level is part of log configuration now, * use {@link #init(LogConfiguration, Printer...)} instead, since 1.3.0 */ @Deprecated public static void init(int logLevel, LogConfiguration logConfiguration, Printer... printers) { init(new LogConfiguration.Builder(logConfiguration).logLevel(logLevel).build(), printers); }
@Override public void onCreate() { super.onCreate(); LogConfiguration config=new LogConfiguration.Builder() .logLevel(BuildConfig.DEBUG ? LogLevel.ALL : LogLevel.NONE) .tag("LocationPoller") .build(); Printer filePrinter= new FilePrinter.Builder(getExternalFilesDir(null).getAbsolutePath()) .fileNameGenerator(new DateFileNameGenerator()) .build(); XLog.init(config, new AndroidPrinter(), filePrinter); } }
LogConfiguration.Builder logConfigBuilder = new LogConfiguration.Builder( XLog.sLogConfiguration);
LogConfiguration config = new LogConfiguration.Builder()
/** * Initialize log system, should be called only once. * * @param logLevel the log level, logs with a lower level than which would not be printed * @param printers the printers, each log would be printed by all of the printers */ public static void init(int logLevel, Printer... printers) { init(new LogConfiguration.Builder().logLevel(logLevel).build(), printers); }
/** * Initialize log system, should be called only once. * * @since 1.3.0 */ public static void init() { init(new LogConfiguration.Builder().build(), DefaultsFactory.createPrinter()); }
/** * Initialize log system, should be called only once. * * @param logLevel the log level, logs with a lower level than which would not be printed */ public static void init(int logLevel) { init(new LogConfiguration.Builder().logLevel(logLevel).build(), DefaultsFactory.createPrinter()); }
/** * Initialize log system, should be called only once. * * @param printers the printers, each log would be printed by all of the printers * @since 1.3.0 */ public static void init(Printer... printers) { init(new LogConfiguration.Builder().build(), printers); }
@Before public void setup() { XLogUtil.beforeTest(); XLog.init(ALL, new LogConfiguration.Builder().tag(DEFAULT_TAG).build(), new ContainerPrinter(logsContainer)); }