@bonginkan/maria
Version:
MARIA OS v5.9.5 – Self-Evolving Organizational Intelligence OS | Speed Improvement Phase 3: LLM Optimization + Command Refactoring | Performance Measurement + Run Evidence System | Zero ESLint/TypeScript Errors | 人とAIが役割を持ち、学び、進化し続けるための仕事のOS | GraphRAG ×
66 lines (65 loc) • 2.29 kB
TypeScript
/**
* Logger Utility
* Unified management of log output.
*
* From Phase 3 onward, the application layer should use this via the `ILogger` port.
* This file should be treated as a console-based adapter implementation.
*/
import type { ILogger, LogFields } from "../shared/ports/logging";
export declare enum LogLevel {
DEBUG = 0,
INFO = 1,
WARN = 2,
ERROR = 3,
NONE = 4
}
export declare class Logger implements ILogger {
private level;
private readonly prefix;
private format;
constructor(context?: string);
setLevel(level: LogLevel): void;
setFormat(format: "pretty" | "json"): void;
private out;
debug(message: string, fields?: LogFields): void;
info(message: string, fields?: LogFields): void;
warn(message: string, fields?: LogFields): void;
error(message: string, fields?: LogFields): void;
success(...args: unknown[]): void;
task(taskName: string, status: "start" | "progress" | "complete" | "error", message?: string): void;
table(data: Record<string, unknown>[]): void;
json(obj: unknown, pretty?: boolean): void;
divider(): void;
/**
* Create a child logger with additional context.
*
* For compatibility with existing code, supports a pino-like signature:
* `logger.child({ module: "name" })`.
* - If context is a string, use it directly as the prefix context.
* - If context is an object, prefer the `module` field; otherwise join `key=value` pairs.
*/
child(context?: string | {
module?: string;
} | Record<string, unknown>): Logger;
clear(): void;
/**
* Render a progress bar.
*/
progress(current: number, total: number, label?: string): void;
}
/**
* Default implementation for console output.
*
* - Use `new ConsoleLogger("Context")` when you want a named context prefix
* - For compatibility with existing code, keep exporting the `logger` singleton
*/
export declare class ConsoleLogger extends Logger {
}
export interface ChildLoggerFields extends LogFields {
module?: string;
}
export declare class ChildCapableConsoleLogger extends Logger {
constructor(context?: string);
child(fields: ChildLoggerFields): ChildCapableConsoleLogger;
}
export declare const logger: ChildCapableConsoleLogger;