Search in sources :

Example 1 with Logger

use of com.amplifyframework.logging.Logger in project amplify-android by aws-amplify.

the class PersistentLogStoragePluginTest method logsAreStored.

/**
 * Tests that a log emitted by a PersistentLogger is stored.
 */
@Test
public void logsAreStored() {
    PersistentLogStoragePlugin plugin = new PersistentLogStoragePlugin();
    Logger logger = plugin.forNamespace("logging-test");
    String message = "Error log";
    Throwable throwable = new Throwable("error message");
    logger.error(message, throwable);
    List<LogEntry> logs = plugin.getLogs();
    assertEquals(1, logs.size());
    LogEntry expectedLog = new LogEntry(logs.get(0).getDate(), logger.getNamespace(), message, throwable, LogLevel.ERROR);
    assertEquals(expectedLog, logs.get(0));
}
Also used : Logger(com.amplifyframework.logging.Logger) Test(org.junit.Test)

Aggregations

Logger (com.amplifyframework.logging.Logger)1 Test (org.junit.Test)1