mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
29 lines
810 B
TypeScript
29 lines
810 B
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import winston from 'winston';
|
|
|
|
const logger = winston.createLogger({
|
|
level: 'info',
|
|
format: winston.format.combine(
|
|
// First, add a timestamp to the log info object
|
|
winston.format.timestamp({
|
|
format: 'YYYY-MM-DD HH:mm:ss.SSS A', // Custom timestamp format
|
|
}),
|
|
// Here we define the custom output format
|
|
winston.format.printf((info) => {
|
|
const { level, timestamp, message, ...rest } = info;
|
|
return (
|
|
`[${level.toUpperCase()}] ${timestamp} -- ${message}` +
|
|
`${Object.keys(rest).length > 0 ? `\n${JSON.stringify(rest, null, 2)}` : ''}`
|
|
); // Only print ...rest if present
|
|
}),
|
|
),
|
|
transports: [new winston.transports.Console()],
|
|
});
|
|
|
|
export { logger };
|