18 lines
796 B
TypeScript
18 lines
796 B
TypeScript
import { winston } from "@strapi/logger";
|
|
import { formatLogLine } from "../src/logging/format";
|
|
|
|
// Strapi 4.25 creates its logger from @strapi/logger's default configuration with this object assigned over it
|
|
// (Strapi.js: createLogger(this.config.get("logger"))). Its default level is "silly", which writes every line, also the debug and
|
|
// silly lines with order data such as names and addresses. Production (NODE_ENV=production in mp's compose.yml) writes info and
|
|
// above, any other environment debug and above.
|
|
const level = process.env.NODE_ENV === "production" ? "info" : "debug";
|
|
|
|
export default {
|
|
level,
|
|
transports: [
|
|
new winston.transports.Console({
|
|
format: winston.format.combine(winston.format.printf((info) => formatLogLine(info, { stack: level === "debug" })))
|
|
})
|
|
]
|
|
};
|