UNPKG

scai

Version:

> AI-powered CLI tool for commit messages **and** pull request reviews — using local models.

16 lines (15 loc) 577 B
import fs from 'fs'; import { LOG_PATH } from '../constants.js'; export function log(...args) { const timestamp = new Date().toISOString(); const message = args.map(arg => typeof arg === 'string' ? arg : JSON.stringify(arg, null, 2)).join(' '); const isBackground = process.env.BACKGROUND_MODE === 'true'; if (isBackground) { // If running in background, log to a file fs.appendFileSync(LOG_PATH, `[${timestamp}] ${message}\n`); } else { // Otherwise, log to the console console.log(`[${timestamp}] ${message}`); } }