LogConfiguration config = new LogConfiguration.Builder() .logLevel(BuildConfig.DEBUG ? LogLevel.ALL // Specify log level, logs below this level won't be printed, default: LogLevel.ALL : LogLevel.NONE) .tag(getString(R.string.global_tag)) // Specify TAG, default: "X-LOG" .addInterceptor(new BlacklistTagsFilterInterceptor( // Add blacklist tags filter "blacklist1", "blacklist2", "blacklist3")) .build();
LogConfiguration.Builder logConfigBuilder = new LogConfiguration.Builder( XLog.sLogConfiguration); logConfigBuilder.logLevel(builder.logLevel); logConfigBuilder.tag(builder.tag); logConfigBuilder.t(); } else { logConfigBuilder.nt(); logConfigBuilder.st(builder.stackTraceOrigin, builder.stackTraceDepth); } else { logConfigBuilder.nst(); logConfigBuilder.b(); } else { logConfigBuilder.nb(); logConfigBuilder.jsonFormatter(builder.jsonFormatter); logConfigBuilder.xmlFormatter(builder.xmlFormatter); logConfigBuilder.throwableFormatter(builder.throwableFormatter); logConfigBuilder.threadFormatter(builder.threadFormatter); logConfigBuilder.stackTraceFormatter(builder.stackTraceFormatter);
/** * 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); }
/** * 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 * @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 */ public static void init(int logLevel) { init(new LogConfiguration.Builder().logLevel(logLevel).build(), DefaultsFactory.createPrinter()); }
/** * 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 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)); }
@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); } }