UNPKG

scai

Version:

> **AI-powered CLI for local code analysis, commit message suggestions, and natural-language queries.** 100% local, private, GDPR-friendly, made in Denmark/EU with ❤️.

18 lines (17 loc) 640 B
import { LOG_PATH } from "../constants.js"; import fs from 'fs'; export const DEBUG = false; export const SUMMARY_LENGTH = 120; 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}`); } }