1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 /* globals buildSettings */
6 /* eslint-disable no-console */
10 this.log = (function() {
13 const levels = ["debug", "info", "warn", "error"];
14 if (!levels.includes(buildSettings.logLevel)) {
15 console.warn("Invalid buildSettings.logLevel:", buildSettings.logLevel);
20 let startLogging = false;
21 for (const level of levels) {
22 if (buildSettings.logLevel === level) {
26 shouldLog[level] = true;
32 exports.debug = exports.info = exports.warn = exports.error = stub;
34 if (shouldLog.debug) {
35 exports.debug = console.debug;
39 exports.info = console.info;
43 exports.warn = console.warn;
46 if (shouldLog.error) {
47 exports.error = console.error;