-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
75 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { type HelperOptions } from "handlebars" | ||
import { log as logger } from "../classes/Report.js" | ||
|
||
export function log(...args: unknown[]) { | ||
const options: Partial<HelperOptions> = args[args.length - 1] | ||
args.pop() | ||
let level = undefined | ||
if (options.hash.level != null) { | ||
level = options.hash.level | ||
} | ||
logger.settings.minLevel = undefined // reset the log level | ||
|
||
if (level === "silent") { | ||
// temporarily up the log level to suppress the output of conversion related warnings | ||
logger.settings.minLevel = 5 | ||
} else if (level === "silly") { | ||
logger.silly(...args) | ||
} else if (level === "trace") { | ||
logger.trace(...args) | ||
} else if (level === "debug") { | ||
logger.debug(...args) | ||
} else if (level === "info") { | ||
logger.info(...args) | ||
} else if (level === "error") { | ||
logger.error(...args) | ||
} else if (level === "fatal") { | ||
logger.fatal(...args) | ||
} else { | ||
logger.warn(...args) | ||
} | ||
} |