Search in sources :

Example 1 with CollectTrobleshootingLogs

use of org.spf4j.test.log.CollectTrobleshootingLogs in project spf4j by zolyfarkas.

the class Spf4jTestLogRunListenerSingleton method testStarted.

@Override
public void testStarted(final Description description) throws Exception {
    Test ta = description.getAnnotation(Test.class);
    ExecutionContext ctx;
    if (ta != null && ta.timeout() > 0) {
        ctx = ExecutionContexts.start(description.getDisplayName(), ta.timeout(), TimeUnit.MILLISECONDS);
    } else {
        ctx = ExecutionContexts.start(description.getDisplayName());
    }
    CollectTrobleshootingLogs ca = description.getAnnotation(CollectTrobleshootingLogs.class);
    Level mll = ca == null ? minLogLevel : ca.minLevel();
    boolean clp = ca == null ? collectPrinted : ca.collectPrinted();
    collections.put(description, TestLoggers.sys().collect(mll, maxDebugLogsCollected, clp));
    ctxts.put(description, ctx);
    super.testStarted(description);
}
Also used : CollectTrobleshootingLogs(org.spf4j.test.log.CollectTrobleshootingLogs) ExecutionContext(org.spf4j.base.ExecutionContext) Test(org.junit.Test) Level(org.spf4j.test.log.Level)

Aggregations

Test (org.junit.Test)1 ExecutionContext (org.spf4j.base.ExecutionContext)1 CollectTrobleshootingLogs (org.spf4j.test.log.CollectTrobleshootingLogs)1 Level (org.spf4j.test.log.Level)1