Something went wrong. Try again.
The atchess bot. Monitors the firehose, indexes games, plays via Stockfish.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132import pino from 'pino';import { mkdirSync } from 'node:fs';import { dirname } from 'node:path';import type { AppConfig } from './types.js';
export function createLogger(logging: AppConfig['logging']): pino.Logger { const targets: pino.TransportTargetOptions[] = [ { target: 'pino/file', options: { destination: 1 }, // stdout level: logging.level, }, ];
if (logging.file) { mkdirSync(dirname(logging.file), { recursive: true }); targets.push({ target: 'pino/file', options: { destination: logging.file }, level: logging.level, }); }
return pino({ level: logging.level, transport: { targets }, timestamp: pino.stdTimeFunctions.isoTime, });}
export type Logger = pino.Logger;