mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 23:51:55 +00:00
28 lines
634 B
TypeScript
28 lines
634 B
TypeScript
import winston from "winston";
|
|
|
|
// Custom format to add severity tag based on log level
|
|
const addSeverityFormat = winston.format((info) => {
|
|
return {
|
|
...info,
|
|
severity: info.level,
|
|
};
|
|
});
|
|
|
|
// Define your base/parent logger
|
|
const logger = winston.createLogger({
|
|
level: "info",
|
|
format: winston.format.combine(
|
|
winston.format.timestamp(),
|
|
addSeverityFormat(),
|
|
winston.format.json(),
|
|
),
|
|
defaultMeta: {
|
|
service: "openfront",
|
|
environment: process.env.NODE_ENV,
|
|
},
|
|
transports: [new winston.transports.Console()],
|
|
});
|
|
|
|
// Export both the main logger and the child logger factory
|
|
export { logger };
|