This repository has been archived by the owner on Jan 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set log level to debug in run-addon, otherwise default to warn
- Loading branch information
Showing
13 changed files
with
88 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* globals buildSettings */ | ||
|
||
"use strict"; | ||
|
||
this.log = (function () { | ||
let exports = {}; | ||
|
||
const levels = ["debug", "info", "warn", "error"]; | ||
if (! levels.includes(buildSettings.logLevel)) { | ||
console.warn("Invalid buildSettings.logLevel:", buildSettings.logLevel); | ||
} | ||
let shouldLog = {}; | ||
|
||
{ | ||
let startLogging = false; | ||
for (let level of levels) { | ||
if (buildSettings.logLevel === level) { | ||
startLogging = true; | ||
} | ||
if (startLogging) { | ||
shouldLog[level] = true; | ||
} | ||
} | ||
} | ||
|
||
function stub() {} | ||
exports.debug = exports.info = exports.warn = exports.error = stub; | ||
|
||
if (shouldLog.debug) { | ||
exports.debug = console.debug.bind(console); | ||
} | ||
|
||
if (shouldLog.info) { | ||
exports.info = console.info.bind(console); | ||
} | ||
|
||
if (shouldLog.warn) { | ||
exports.warn = console.warn.bind(console); | ||
} | ||
|
||
if (shouldLog.error) { | ||
exports.error = console.error.bind(console); | ||
} | ||
|
||
return exports; | ||
})(); | ||
null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters