refactor: deduplicate logger into shared module (#39)
three files created identical pino logger instances with the same config. extract into src/logger.ts and import from each consumer. net -9 lines, no behavior change. Co-authored-by: ejae <ejae_dev@ejaes-Mac-mini.home> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { exec, execSync } from 'child_process';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import pino from 'pino';
|
||||
|
||||
import makeWASocket, {
|
||||
DisconnectReason,
|
||||
@@ -42,14 +41,10 @@ import {
|
||||
import { startSchedulerLoop } from './task-scheduler.js';
|
||||
import { NewMessage, RegisteredGroup, Session } from './types.js';
|
||||
import { loadJson, saveJson } from './utils.js';
|
||||
import { logger } from './logger.js';
|
||||
|
||||
const GROUP_SYNC_INTERVAL_MS = 24 * 60 * 60 * 1000; // 24 hours
|
||||
|
||||
const logger = pino({
|
||||
level: process.env.LOG_LEVEL || 'info',
|
||||
transport: { target: 'pino-pretty', options: { colorize: true } },
|
||||
});
|
||||
|
||||
let sock: WASocket;
|
||||
let lastTimestamp = '';
|
||||
let sessions: Session = {};
|
||||
|
||||
Reference in New Issue
Block a user