log.d.ts 1.2 KB

1234567891011121314151617181920212223242526
  1. /// <reference types="node" />
  2. import _debug from "debug";
  3. import WritableStream = NodeJS.WritableStream;
  4. export declare const debug: _debug.Debugger;
  5. export interface Fields {
  6. [index: string]: any;
  7. }
  8. export declare function setPrinter(value: ((message: string) => void) | null): void;
  9. export declare type LogLevel = "info" | "warn" | "debug" | "notice" | "error";
  10. export declare const PADDING = 2;
  11. export declare class Logger {
  12. protected readonly stream: WritableStream;
  13. constructor(stream: WritableStream);
  14. messageTransformer: (message: string, level: LogLevel) => string;
  15. filePath(file: string): string;
  16. get isDebugEnabled(): boolean;
  17. info(messageOrFields: Fields | null | string, message?: string): void;
  18. error(messageOrFields: Fields | null | string, message?: string): void;
  19. warn(messageOrFields: Fields | null | string, message?: string): void;
  20. debug(fields: Fields | null, message: string): void;
  21. private doLog;
  22. private _doLog;
  23. static createMessage(message: string, fields: Fields | null, level: LogLevel, color: (it: string) => string, messagePadding?: number): string;
  24. log(message: string): void;
  25. }
  26. export declare const log: Logger;