/** * 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); } }
logConfigBuilder.logLevel(builder.logLevel);
.logLevel(BuildConfig.DEBUG ? LogLevel.ALL // Specify log level, logs below this level won't be printed, default: LogLevel.ALL : LogLevel.NONE)
/** * 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. * * @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()); }