Skip to content

Commit

Permalink
fixed log level detection
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Oct 2, 2023
1 parent f59b359 commit 89ab5bf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions core/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,11 @@ export function env<T>(name: string): T | undefined {
}
}

let level = env<LevelName | "NONE">("LUME_LOG_LEVEL")?.toUpperCase();
let level = env<LevelName>("LUME_LOG_LEVEL")?.toUpperCase() as
| LevelName
| undefined;

if (level === "NOTSET") {
if (!level || level === "NOTSET") {
level = "DEBUG";
}

Expand Down Expand Up @@ -625,8 +627,8 @@ logger.setup({
},
loggers: {
lume: {
level: (level === "NONE" ? "NOTSET" : level) as LevelName,
handlers: level === "NONE" ? [] : ["console"],
level: level as LevelName,
handlers: ["console"],
},
},
});
Expand Down
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
]
},
"tasks": {
"test": "TZ=Z LUME_LOG_LEVEL=NONE deno test -A",
"test": "TZ=Z LUME_LOG_LEVEL=ERROR deno test -A",
"test:update": "deno task test -- --update",
"install": "deno run -A install.ts",
"changelog": "deno run --allow-read --allow-write https://deno.land/x/[email protected]/bin.ts",
Expand Down

0 comments on commit 89ab5bf

Please sign in to comment.