Phase 0-2 of data unification: - Enable WAL mode + busy_timeout for safe concurrent access - router_state: keys prefixed with SERVICE_ID (lazy migration) - sessions: composite PK (group_folder, agent_type) - registered_groups: filtered by SERVICE_AGENT_TYPE on load - Logger: service name tag for unified log streams All changes are backward-compatible with the current split setup. Actual directory merge (Phase 3-4) is a separate step.
20 lines
561 B
TypeScript
20 lines
561 B
TypeScript
import pino from 'pino';
|
|
|
|
const serviceName = (process.env.ASSISTANT_NAME || 'claude').toLowerCase();
|
|
|
|
export const logger = pino({
|
|
level: process.env.LOG_LEVEL || 'info',
|
|
name: serviceName,
|
|
transport: { target: 'pino-pretty', options: { colorize: true } },
|
|
});
|
|
|
|
// Route uncaught errors through pino so they get timestamps in stderr
|
|
process.on('uncaughtException', (err) => {
|
|
logger.fatal({ err }, 'Uncaught exception');
|
|
process.exit(1);
|
|
});
|
|
|
|
process.on('unhandledRejection', (reason) => {
|
|
logger.error({ err: reason }, 'Unhandled rejection');
|
|
});
|