diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /toolkit/components/normandy/test/browser/browser_LogManager.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/normandy/test/browser/browser_LogManager.js')
-rw-r--r-- | toolkit/components/normandy/test/browser/browser_LogManager.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/toolkit/components/normandy/test/browser/browser_LogManager.js b/toolkit/components/normandy/test/browser/browser_LogManager.js new file mode 100644 index 0000000000..6f41b46c63 --- /dev/null +++ b/toolkit/components/normandy/test/browser/browser_LogManager.js @@ -0,0 +1,27 @@ +"use strict"; + +const { LogManager } = ChromeUtils.importESModule( + "resource://normandy/lib/LogManager.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(); + }); +}); |