@farmfe/core
Version:
Farm is a extremely fast web build tool written in Rust. Farm can start a project in milliseconds and perform HMR within 10ms, making it much faster than similar tools like webpack and vite.
61 lines (60 loc) • 2.38 kB
TypeScript
import { Config } from '../types/binding.js';
import { ColorFunction } from './color.js';
type LogLevelNames = 'trace' | 'debug' | 'info' | 'warn' | 'error';
export interface ILogger {
trace(message: string): void;
debug(message: string): void;
info(message: string): void;
warn(message: string): void;
warnOnce(message: string): void;
errorOnce(message: string | Error): void;
error(message: string | Error, options?: ErrorOptions): void;
}
export interface ErrorOptions {
exit?: boolean;
e?: Error;
error?: Error;
}
interface LoggerOptions {
name?: string;
brandColor?: ColorFunction;
exit?: boolean;
}
export declare class Logger implements ILogger {
options?: LoggerOptions;
private levelValues;
private prefix?;
constructor(options?: LoggerOptions, levelValues?: Record<LogLevelNames, number>, prefix?: string);
private brandPrefix;
private logMessage;
setPrefix(options: LoggerOptions): void;
trace(message: string): void;
debug(message: string): void;
info(message: string, iOptions?: LoggerOptions): void;
warn(message: string): void;
error(message: string | Error, errorOptions?: ErrorOptions): void;
infoOnce(message: string): void;
warnOnce(message: string): void;
errorOnce(message: string | Error): void;
hasErrorLogged(message: string | Error): boolean;
hasWarnLogged(message: string): boolean;
}
export declare class NoopLogger extends Logger {
setPrefix(_options: LoggerOptions): void;
trace(_message: string): void;
debug(_message: string): void;
info(_message: string, _iOptions?: LoggerOptions): void;
warn(_message: string): void;
error(_message: string | Error, _errorOptions?: ErrorOptions): void;
infoOnce(_message: string): void;
warnOnce(_message: string): void;
errorOnce(_message: string | Error): void;
hasErrorLogged(_message: string | Error): boolean;
hasWarnLogged(_message: string): boolean;
}
export declare function printServerUrls(urls: any, logger: Logger, previewFlag?: boolean): void;
export declare function bootstrapLogger(options?: LoggerOptions): Logger;
export declare function bootstrap(times: number, config: Config): void;
export declare const logger: Logger;
export declare function buildErrorMessage(err: any, args?: string[], includeStack?: boolean): string;
export {};