mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
- 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.
38 lines
990 B
TypeScript
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()
|