jorel
Version:
A unified wrapper for working with LLMs from multiple providers, including streams, images, documents & automatic tool use.
83 lines (82 loc) • 3.87 kB
TypeScript
import { Logger } from "winston";
export type LogLevel = "silent" | "error" | "warn" | "info" | "verbose" | "debug" | "silly";
export type LoggerOption = "console" | ((level: string, message: string, context?: object) => void) | Logger;
/**
* A service for logging messages to the console or other destinations.
*/
export declare class LogService {
constructor(loggerOption?: LoggerOption, logLevel?: LogLevel);
/**
* Gets the current logging level of the logger.
* @returns The current log level.
*/
get logLevel(): LogLevel;
/**
* Updates the logging level of the logger dynamically.
* Useful for changing verbosity without recreating the logger.
* @param logLevel The new log level to set.
*/
set logLevel(logLevel: LogLevel);
/**
* Clears all transports (output destinations) from the logger.
* This can be useful if you want to dynamically reconfigure logging outputs.
*/
clear(): void;
/**
* Logs a message at the specified level with optional context.
* Use this method for dynamically specified levels.
* @param logDomain The domain or category of the log message.
* @param level The log level (e.g., "info", "error").
* @param message The message to log.
* @param context Optional metadata or contextual information to include.
*/
log(logDomain: string, level: LogLevel, message: string, context?: object): void;
/**
* Logs a silly message with optional context.
* Use for extremely detailed information during development and debugging.
* @param logDomain The domain or category of the log message.
* @param message The message to log.
* @param context Optional metadata or contextual information to include.
*/
silly(logDomain: string, message: string, context?: object): void;
/**
* Logs a debug message with optional context.
* Use for detailed information during development and debugging.
* @param logDomain The domain or category of the log message.
* @param message The message to log.
* @param context Optional metadata or contextual information to include.
*/
debug(logDomain: string, message: string, context?: object): void;
/**
* Logs a verbose message with optional context.
* Use for detailed operational logs that are more verbose than "info".
* @param logDomain The domain or category of the log message.
* @param message The message to log.
* @param context Optional metadata or contextual information to include.
*/
verbose(logDomain: string, message: string, context?: object): void;
/**
* Logs an informational message with optional context.
* Use for high-level operational messages and significant events.
* @param logDomain The domain or category of the log message.
* @param message The message to log.
* @param context Optional metadata or contextual information to include.
*/
info(logDomain: string, message: string, context?: object): void;
/**
* Logs a warning message with optional context.
* Use for recoverable issues or noteworthy events that might require attention.
* @param logDomain The domain or category of the log message.
* @param message The message to log.
* @param context Optional metadata or contextual information to include.
*/
warn(logDomain: string, message: string, context?: object): void;
/**
* Logs an error message with optional context.
* Use for critical issues or exceptions that require immediate attention.
* @param logDomain The domain or category of the log message.
* @param message The message to log.
* @param context Optional metadata or contextual information to include.
*/
error(logDomain: string, message: string, context?: object): void;
}