Navigation Menu

Skip to content

Commit

Permalink
Add warning level to logger
Browse files Browse the repository at this point in the history
  • Loading branch information
rvl committed May 3, 2021
1 parent c09eb7d commit cc485fd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/logging.ts
Expand Up @@ -17,6 +17,7 @@
export interface Logger {
debug: LogFunc;
info: LogFunc;
warn: LogFunc;
error: LogFunc;
}

Expand All @@ -36,7 +37,7 @@ export interface LogFunc {
*/
export function prependName(logger: Logger, name: string): Logger {
const prefix = (
severity: 'debug' | 'info' | 'error',
severity: 'debug' | 'info' | 'warn' | 'error',
msg: string,
param?: any
): void => {
Expand All @@ -50,6 +51,7 @@ export function prependName(logger: Logger, name: string): Logger {
return {
debug: (msg: string, param?: any): void => prefix('debug', msg, param),
info: (msg: string, param?: any): void => prefix('info', msg, param),
warn: (msg: string, param?: any): void => prefix('warn', msg, param),
error: (msg: string, param?: any): void => prefix('error', msg, param),
};
}

0 comments on commit cc485fd

Please sign in to comment.