Download packages/server/src/utils/logger.ts from E5K7/asipilot: direct link, hf CLI and curl.
- Browser
- Download file 719 Bytes
-
https://huggingface.co/spaces/E5K7/asipilot/resolve/main/packages/server/src/utils/logger.ts
- Command line
-
hf download hf://spaces/E5K7/asipilot/packages/server/src/utils/logger.ts
-
curl -L -o logger.ts https://huggingface.co/spaces/E5K7/asipilot/resolve/main/packages/server/src/utils/logger.ts
719 Bytes
| 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: 'asipilot-server' }, | |
| }); | |