GLMPilot / packages /server /src /utils /logger.ts
E5K7's picture
Initial commit: Rebranded to GLMPilot and migrated to GLM-5 API
c2c8c8d
import winston from 'winston';
import { config } from '../config/env.js';
const { combine, timestamp, printf, colorize, json } = winston.format;
const devFormat = combine(
colorize(),
timestamp({ format: 'HH:mm:ss' }),
printf(({ level, message, timestamp, ...meta }) => {
const metaStr = Object.keys(meta).length ? ` ${JSON.stringify(meta)}` : '';
return `${timestamp} ${level}: ${message}${metaStr}`;
})
);
const prodFormat = combine(timestamp(), json());
export const logger = winston.createLogger({
level: config.LOG_LEVEL,
format: config.NODE_ENV === 'production' ? prodFormat : devFormat,
transports: [new winston.transports.Console()],
defaultMeta: { service: 'glmpilot-server' },
});