@blast-shield/logger
Version:
Logger utility for blast-shield
140 lines (135 loc) âĸ 3.75 kB
TypeScript
/**
* Base Logger class for extending with specialized loggers
*/
declare class BaseLogger {
protected prefix: string;
constructor(prefix?: string);
/**
* Sets a prefix for all log messages
*/
setPrefix(prefix: string): void;
/**
* Log an informational message
*/
info(message: string, additionalInfo?: string): void;
/**
* Log a warning message
*/
warn(message: string): void;
/**
* Log an error message
*/
error(message: string | Error, additionalInfo?: string): void;
/**
* Log success messages
*/
success(message: string): void;
/**
* Log notes/memos
*/
note(message: string): void;
/**
* Log important highlighted information
*/
star(message: string): void;
/**
* Log task start
*/
start(message: string): void;
/**
* Log task completion
*/
complete(message: string): void;
/**
* Log pending tasks
*/
pending(message: string): void;
/**
* Log waiting for something
*/
await(message: string): void;
/**
* Log something being watched
*/
watch(message: string): void;
/**
* Log debug messages
*/
debug(message: string): void;
/**
* Log a message with a dry run prefix
*/
dryRun(message: string): void;
}
declare const baseLogger: {
/** Log informational messages */
info: (message: string) => void;
/** Log debug messages */
debug: (message: string) => void;
/** Log warning messages */
warn: (message: string) => void;
/** Log error messages */
error: (message: string | Error, additionalInfo?: string) => void;
/** Log success messages */
success: (message: string) => void;
/** Log notes/memos */
note: (message: string) => void;
/** Log important highlighted information */
star: (message: string) => void;
/** Log task start */
start: (message: string) => void;
/** Log task completion */
complete: (message: string) => void;
/** Log pending tasks */
pending: (message: string) => void;
/** Log waiting for something */
await: (message: string) => void;
/** Log something being watched */
watch: (message: string) => void;
/**
* Log a message with a dry run prefix
*/
dryRun: (message: string) => void;
};
/**
* Constants for logging emojis to maintain consistent style
*/
declare const EMOJI: {
readonly STAR: "â";
readonly BUG: "đ";
readonly WRENCH: "đ§";
readonly PENCIL: "đ";
readonly ROCKET: "đ";
readonly SPARKLE: "â¨";
readonly INFO: "âšī¸";
readonly CHECK: "â
";
readonly NOTE: "đ";
};
/**
* Generic logger class extending the base logger with emoji support
*/
declare class Logger extends BaseLogger {
constructor(prefix?: string);
/**
* Log an informational message with optional emoji
*/
info(message: string, emoji?: keyof typeof EMOJI): void;
/**
* Log a warning message with optional emoji
*/
warn(message: string, emoji?: keyof typeof EMOJI): void;
/**
* Log an error message with optional emoji and additional info
*/
error(message: string | Error, emoji?: keyof typeof EMOJI, additionalInfo?: string): void;
/**
* Log a success message with optional emoji
*/
success(message: string, emoji?: keyof typeof EMOJI): void;
}
/**
* Export the standard logger instance
*/
declare const logger: Logger;
type LogLevel = "info" | "debug" | "warn" | "error" | "success" | "note" | "star" | "start" | "complete" | "pending" | "await" | "watch";
export { BaseLogger, EMOJI, type LogLevel, Logger, baseLogger, logger };