blob: 65f64c994bf507c5ac615ab6d5303345652238df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
"use strict";
const { LogManager } = ChromeUtils.importESModule(
"resource://normandy/lib/LogManager.sys.mjs"
);
const { Log } = ChromeUtils.importESModule(
"resource://gre/modules/Log.sys.mjs"
);
add_task(async function () {
// Ensure that configuring the logger affects all generated loggers.
const firstLogger = LogManager.getLogger("first");
LogManager.configure(5);
const secondLogger = LogManager.getLogger("second");
is(firstLogger.level, 5, "First logger level inherited from root logger.");
is(secondLogger.level, 5, "Second logger level inherited from root logger.");
// Ensure that our loggers have at least one appender.
LogManager.configure(Log.Level.Warn);
const logger = LogManager.getLogger("test");
ok(!!logger.appenders.length, "Loggers have at least one appender.");
// Ensure our loggers log to the console.
await new Promise(resolve => {
SimpleTest.waitForExplicitFinish();
SimpleTest.monitorConsole(resolve, [{ message: /legend has it/ }]);
logger.warn("legend has it");
SimpleTest.endMonitorConsole();
});
});
|