Download electron/src/utils/logger.ts from qf46578/OmniCS: direct link, hf CLI and curl.
- Browser
- Download file 975 Bytes
-
https://huggingface.co/qf46578/OmniCS/resolve/main/electron/src/utils/logger.ts
- Command line
-
hf download hf://qf46578/OmniCS/electron/src/utils/logger.ts
-
curl -L -o logger.ts https://huggingface.co/qf46578/OmniCS/resolve/main/electron/src/utils/logger.ts
975 Bytes
| import winston from 'winston'; | |
| import path from 'path'; | |
| const logFormat = winston.format.combine( | |
| winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), | |
| winston.format.printf(({ level, message, timestamp }) => { | |
| return `${timestamp} [${level.toUpperCase()}]: ${message}`; | |
| }) | |
| ); | |
| export function createLogger(module: string): winston.Logger { | |
| const logDir = process.env.LOG_DIR || path.join(process.cwd(), 'logs'); | |
| return winston.createLogger({ | |
| level: process.env.LOG_LEVEL || 'info', | |
| defaultMeta: { module }, | |
| transports: [ | |
| new winston.transports.Console({ | |
| format: winston.format.combine( | |
| winston.format.colorize(), | |
| winston.format.printf(({ level, message, timestamp }) => { | |
| return `${timestamp} [${level}]: ${message}`; | |
| }) | |
| ), | |
| }), | |
| new winston.transports.File({ | |
| filename: path.join(logDir, 'electron.log'), | |
| format: logFormat, | |
| }), | |
| ], | |
| }); | |
| } | |