o134 commited on
Commit
ea7aed8
·
verified ·
1 Parent(s): 161d590

Upload api-server\src\lib\logger.ts with huggingface_hub

Browse files
Files changed (1) hide show
  1. api-server//src//lib//logger.ts +20 -0
api-server//src//lib//logger.ts ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pino from "pino";
2
+
3
+ const isProduction = process.env.NODE_ENV === "production";
4
+
5
+ export const logger = pino({
6
+ level: process.env.LOG_LEVEL ?? "info",
7
+ redact: [
8
+ "req.headers.authorization",
9
+ "req.headers.cookie",
10
+ "res.headers['set-cookie']",
11
+ ],
12
+ ...(isProduction
13
+ ? {}
14
+ : {
15
+ transport: {
16
+ target: "pino-pretty",
17
+ options: { colorize: true },
18
+ },
19
+ }),
20
+ });