2020-01-02 15:13:47 -05:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
2019-05-30 08:59:30 -04:00
|
|
|
export const LogLevel: Record<string, number> = {
|
2019-01-02 09:12:48 -05:00
|
|
|
NOTSET: 0,
|
2018-12-19 13:16:45 -05:00
|
|
|
DEBUG: 10,
|
|
|
|
INFO: 20,
|
|
|
|
WARNING: 30,
|
|
|
|
ERROR: 40,
|
|
|
|
CRITICAL: 50
|
|
|
|
};
|
|
|
|
|
|
|
|
const byLevel = {
|
2019-01-02 09:12:48 -05:00
|
|
|
[LogLevel.NOTSET]: "NOTSET",
|
2018-12-19 13:16:45 -05:00
|
|
|
[LogLevel.DEBUG]: "DEBUG",
|
|
|
|
[LogLevel.INFO]: "INFO",
|
|
|
|
[LogLevel.WARNING]: "WARNING",
|
|
|
|
[LogLevel.ERROR]: "ERROR",
|
|
|
|
[LogLevel.CRITICAL]: "CRITICAL"
|
|
|
|
};
|
|
|
|
|
2019-01-02 09:12:48 -05:00
|
|
|
export function getLevelByName(name: string): number {
|
2019-05-30 08:59:30 -04:00
|
|
|
return LogLevel[name];
|
2018-12-19 13:16:45 -05:00
|
|
|
}
|
|
|
|
|
2019-01-02 09:12:48 -05:00
|
|
|
export function getLevelName(level: number): string {
|
2018-12-19 13:16:45 -05:00
|
|
|
return byLevel[level];
|
|
|
|
}
|