@Test public void testThread() { XLog.t().t().i("Message with thread info"); boolean result = (logsContainer.size() == 1 && logsContainer.get(0).msg.contains("Thread: ")); assertTrue("No thread info found", result); logsContainer.clear(); XLog.t().nt().i("Message without thread info"); result = (logsContainer.size() == 1 && !logsContainer.get(0).msg.contains("Thread: ")); assertTrue("Thread info found", result); }
builder.t(); } else { builder.nt();
@Test public void testCustomThreadFormatter() { final String formattedThread = "This is the thread info"; XLog.threadFormatter( new ThreadFormatter() { @Override public String format(Thread data) { return formattedThread; } }) .t() .i(MESSAGE); assertLog(INFO, DEFAULT_TAG, formattedThread + "\n" + MESSAGE); }
/** * Start to customize a {@link Logger} and enable thread info. * * @return the {@link Logger.Builder} to build the {@link Logger} */ public static Logger.Builder t() { return new Logger.Builder().t(); }