mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-17 23:12:23 +00:00
feat(log): add pino logging support
This commit is contained in:
parent
4b4dcb1ff5
commit
613dd5ef17
@ -3,7 +3,7 @@ import createNextIntlPlugin from 'next-intl/plugin';
|
|||||||
|
|
||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
output: "standalone",
|
output: "standalone",
|
||||||
serverExternalPackages: ["dockerode"],
|
serverExternalPackages: ["dockerode", "pino", "pino-pretty"],
|
||||||
};
|
};
|
||||||
|
|
||||||
const withNextIntl = createNextIntlPlugin();
|
const withNextIntl = createNextIntlPlugin();
|
||||||
|
21
src/lib/logger.ts
Normal file
21
src/lib/logger.ts
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import pino from "pino";
|
||||||
|
|
||||||
|
const logger =
|
||||||
|
process.env["NODE_ENV"] === "production"
|
||||||
|
? // JSON in production
|
||||||
|
pino({ level: "info" })
|
||||||
|
: // Pretty print in development
|
||||||
|
pino({
|
||||||
|
level: "debug",
|
||||||
|
transport: {
|
||||||
|
target: "pino-pretty",
|
||||||
|
options: {
|
||||||
|
levelFirst: true,
|
||||||
|
colorize: true,
|
||||||
|
ignore: "hostname,pid",
|
||||||
|
translateTime: "yyyy-mm-dd HH:MM:ss",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export { logger };
|
Loading…
Reference in New Issue
Block a user