diff options
| author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2019-01-02 15:12:48 +0100 |
|---|---|---|
| committer | Ryan Dahl <ry@tinyclouds.org> | 2019-01-02 09:12:48 -0500 |
| commit | 4659271518b71b90eb82b05b8aeb655c82a8a93e (patch) | |
| tree | 629d81dad90ec6106f13901e25f2f5142e195026 /logging/levels.ts | |
| parent | bc4635a5938513886c7c6d1801e6ebcddf62b699 (diff) | |
Improve logging module (denoland/deno_std#51)
Original: https://github.com/denoland/deno_std/commit/439885c756615f4da4953460c47d58cc9cc5bd2b
Diffstat (limited to 'logging/levels.ts')
| -rw-r--r-- | logging/levels.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/logging/levels.ts b/logging/levels.ts index 8ba8a8fec..52d28aea5 100644 --- a/logging/levels.ts +++ b/logging/levels.ts @@ -1,4 +1,5 @@ export const LogLevel = { + NOTSET: 0, DEBUG: 10, INFO: 20, WARNING: 30, @@ -7,14 +8,16 @@ export const LogLevel = { }; const byName = { + NOTSET: LogLevel.NOTSET, DEBUG: LogLevel.DEBUG, INFO: LogLevel.INFO, WARNING: LogLevel.WARNING, ERROR: LogLevel.ERROR, - CRITICAL: LogLevel.DEBUG + CRITICAL: LogLevel.CRITICAL }; const byLevel = { + [LogLevel.NOTSET]: "NOTSET", [LogLevel.DEBUG]: "DEBUG", [LogLevel.INFO]: "INFO", [LogLevel.WARNING]: "WARNING", @@ -22,10 +25,10 @@ const byLevel = { [LogLevel.CRITICAL]: "CRITICAL" }; -export function getLevelByName(name) { +export function getLevelByName(name: string): number { return byName[name]; } -export function getLevelName(level) { +export function getLevelName(level: number): string { return byLevel[level]; } |
