Files
cms/config/logger.ts
T
libretech 5002cac469
build / test (push) Successful in 11s
build / build (push) Successful in 8m31s
Checkout: only customer fields on order updates, verified PayPal capture, safe logging (#6)
Co-authored-by: Michael Czechowski <mail@librete.ch>
2026-10-15 10:23:02 +02:00

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" })))
})
]
};