Files
opencode-manager/backend/src/utils/logger.ts
T
Chris Scott 8d0d961e50 Rename project from opencode-webui to opencode-manager
- Update package names from opencode-webui to opencode-manager
- Update all backend import statements to use @opencode-manager/shared
- Update Docker configuration and container name
- Update README.md with new repository URLs and project title
- Update frontend assets and titles
- Update version to 0.4.0
- Update docker entrypoint script comments

This change maintains all functionality while better reflecting the
project's purpose as a comprehensive management interface for OpenCode.
2025-12-12 13:58:08 -05:00

38 lines
990 B
TypeScript

import { ENV } from '@opencode-manager/shared'
type LogLevel = 'info' | 'warn' | 'error' | 'debug'
class Logger {
private prefix: string
constructor(prefix: string = '') {
this.prefix = prefix
}
private format(level: LogLevel, message: string): string {
const timestamp = new Date().toISOString()
const prefixStr = this.prefix ? `[${this.prefix}] ` : ''
return `[${timestamp}] [${level.toUpperCase()}] ${prefixStr}${message}`
}
info(message: string, ...args: unknown[]): void {
console.log(this.format('info', message), ...args)
}
warn(message: string, ...args: unknown[]): void {
console.warn(this.format('warn', message), ...args)
}
error(message: string, ...args: unknown[]): void {
console.error(this.format('error', message), ...args)
}
debug(message: string, ...args: unknown[]): void {
if (ENV.LOGGING.DEBUG) {
console.debug(this.format('debug', message), ...args)
}
}
}
export const logger = new Logger()