UNPKG

tw-runner

Version:

Run and manage Tower Website projects with this utility.

33 lines (28 loc) 782 B
import fs from 'fs'; import path from 'path'; // Enhanced logging system export default class Logger { LOG_FILE = "RUNNER.log"; constructor() { this.stream = fs.createWriteStream( path.join(process.cwd(), this.LOG_FILE), { flags: 'a' } ); } log(message, type = 'info') { const timestamp = new Date().toISOString(); const formatted = `[${timestamp}] [${type.toUpperCase()}] ${message}\n`; this.stream.write(formatted); // Color coding for console (optional) const colors = { info: '\x1b[36m', // Cyan success: '\x1b[32m', // Green warning: '\x1b[33m', // Yellow error: '\x1b[31m' // Red }; console.log(`${colors[type] || ''}${message}\x1b[0m`); } close() { this.stream.end(); } }