11import { InspectOptions } from "node:util" ;
22
3- export type LogLevelLiteral =
4- | "fatal"
5- | "error"
6- | "warn"
7- | "log"
8- | "info"
9- | "success"
10- | "fail"
11- | "debug"
12- | "trace"
13- | "silent"
14- | "verbose" ;
15-
163export type LogLevel = number ; // Built-in: 0 | 1 | 2 | 3 | 4 | 5;
174
18- export type logType =
5+ export type LogType =
196 // 0
207 | "silent"
218 | "fatal"
@@ -35,9 +22,9 @@ export type logType =
3522 | "verbose" ;
3623
3724export interface ConsolaLogObject {
38- level ?: LogLevel | LogLevelLiteral ;
25+ level ?: LogLevel | LogType ;
3926 tag ?: string ;
40- type ?: logType ;
27+ type ?: LogType ;
4128 message ?: string ;
4229 additional ?: string | string [ ] ;
4330 args ?: any [ ] ;
@@ -46,7 +33,7 @@ export interface ConsolaLogObject {
4633
4734export interface ConsolaReporterLogObject {
4835 level : LogLevel ;
49- type : logType ;
36+ type : LogType ;
5037 tag : string ;
5138 args : any [ ] ;
5239 date : Date ;
@@ -55,7 +42,7 @@ export interface ConsolaReporterLogObject {
5542export type ConsolaMock = ( ...args : any ) => void ;
5643
5744export type ConsolaMockFn = (
58- type : logType ,
45+ type : LogType ,
5946 defaults : ConsolaLogObject
6047) => ConsolaMock ;
6148
@@ -70,7 +57,7 @@ export interface ConsolaReporter {
7057
7158export interface ConsolaOptions {
7259 reporters : ConsolaReporter [ ] ;
73- types : Record < logType , ConsolaLogObject > ;
60+ types : Record < LogType , ConsolaLogObject > ;
7461 level : LogLevel ;
7562 defaults : ConsolaLogObject ;
7663 throttle : number ;
@@ -84,50 +71,5 @@ export interface ConsolaOptions {
8471export interface BasicReporterOptions {
8572 dateFormat ?: string ;
8673 formatOptions ?: InspectOptions ;
87- }
88-
89- export declare class BasicReporter implements ConsolaReporter {
90- protected options : BasicReporterOptions ;
91-
92- constructor ( options ?: BasicReporterOptions ) ;
93-
94- public log ( logObj : ConsolaReporterLogObject , args : ConsolaReporterArgs ) : void ;
95-
96- protected formatStack ( stack : string ) : string ;
97- protected formatArgs ( args : any [ ] ) : string ;
98- protected formatDate ( date : Date ) : string ;
99- protected filterAndJoin ( arr : Array < string | undefined > ) : string ;
100- protected formatLogObj ( logObj : ConsolaReporterLogObject ) : string ;
101- }
102-
103- export interface FancyReporterOptions extends BasicReporterOptions {
10474 secondaryColor ?: string ;
10575}
106-
107- export declare class FancyReporter extends BasicReporter {
108- constructor ( options ?: FancyReporterOptions ) ;
109-
110- protected formatType ( logObj : ConsolaReporterLogObject ) : void ;
111- }
112-
113- export type BrowserReporterOptions = Record < string , any > ;
114-
115- export declare class BrowserReporter implements ConsolaReporter {
116- public log ( logObj : ConsolaReporterLogObject , args : ConsolaReporterArgs ) : void ;
117- }
118-
119- export type JSONReporterOptions = {
120- stream ?: NodeJS . WritableStream ;
121- } ;
122-
123- export declare class JSONReporter implements ConsolaReporter {
124- constructor ( options ?: JSONReporterOptions ) ;
125- public log ( logObj : ConsolaReporterLogObject , args : ConsolaReporterArgs ) : void ;
126- }
127-
128- export type Winston = any ;
129-
130- export declare class WinstonReporter implements ConsolaReporter {
131- constructor ( logger ?: Winston ) ;
132- public log ( logObj : ConsolaReporterLogObject , args : ConsolaReporterArgs ) : void ;
133- }
0 commit comments