mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
fix: respect LOG_LEVEL env var in Pino logger
This commit is contained in:
+3
-1
@@ -1,6 +1,8 @@
|
|||||||
import pino, { type Logger } from "pino";
|
import pino, { type Logger } from "pino";
|
||||||
|
|
||||||
const isProd = process.env.NODE_ENV === "production";
|
const isProd = process.env.NODE_ENV === "production";
|
||||||
|
const defaultLevel = isProd ? "info" : "debug";
|
||||||
|
const level = (process.env.LOG_LEVEL || defaultLevel) as pino.Level;
|
||||||
|
|
||||||
function getLocalTimestamp() {
|
function getLocalTimestamp() {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
@@ -19,7 +21,7 @@ function getLocalTimestamp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const logger: Logger = pino({
|
export const logger: Logger = pino({
|
||||||
level: isProd ? "info" : "debug",
|
level,
|
||||||
base: null,
|
base: null,
|
||||||
|
|
||||||
...(isProd
|
...(isProd
|
||||||
|
|||||||
Reference in New Issue
Block a user