保誠-保戶業務員媒合平台
HelenHuang
2022-06-09 26a09f08cf1ed43c640879f23fdad56c5c9282f7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
import { InspectOptions } from 'util';
 
export enum LogLevel {
  Fatal= 0,
  Error= 0,
  Warn= 1,
  Log= 2,
  Info= 3,
  Success= 3,
  Debug= 4,
  Trace= 5,
  Silent= -Infinity,
  Verbose= Infinity,
}
 
export type logType =
  | 'silent'
  | 'fatal'
  | 'error'
  | 'warn'
  | 'log'
  | 'info'
  | 'success'
  | 'debug'
  | 'trace'
  | 'verbose'
  | 'ready'
  | 'start'
 
export interface ConsolaLogObject {
  level?: LogLevel,
  tag?: string,
  type?: logType,
  message?: string,
  additional?: string | string[],
  args?: any[],
  date?: Date,
}
 
export interface ConsolaReporterLogObject {
  level: LogLevel,
  type: logType,
  tag: string;
  args: any[],
  date: Date,
}
 
type ConsolaMock = (...args: any) => void
 
type ConsolaMockFn = (type: logType, defaults: ConsolaLogObject) => ConsolaMock
 
export interface ConsolaReporterArgs {
  async: boolean,
  stdout: NodeJS.WritableStream,
  stderr: NodeJS.WritableStream,
}
 
export interface ConsolaReporter {
  log: (logObj: ConsolaReporterLogObject, args: ConsolaReporterArgs) => void
}
 
export interface ConsolaOptions {
  reporters?: ConsolaReporter[],
  types?: { [type in logType]: ConsolaLogObject },
  level?: LogLevel,
  defaults?: ConsolaLogObject,
  async?: boolean,
  stdout?: NodeJS.WritableStream,
  stderr?: NodeJS.WritableStream,
  mockFn?: ConsolaMockFn,
  throttle?: number,
}
 
export declare class Consola {
  constructor(options: ConsolaOptions)
 
  level: LogLevel
  readonly stdout: NodeJS.WritableStream
  readonly stderr: NodeJS.WritableStream
 
  // Built-in log levels
  fatal(message: ConsolaLogObject | any, ...args: any[]): void
  error(message: ConsolaLogObject | any, ...args: any[]): void
  warn(message: ConsolaLogObject | any, ...args: any[]): void
  log(message: ConsolaLogObject | any, ...args: any[]): void
  info(message: ConsolaLogObject | any, ...args: any[]): void
  start(message: ConsolaLogObject | any, ...args: any[]): void
  success(message: ConsolaLogObject | any, ...args: any[]): void
  ready(message: ConsolaLogObject | any, ...args: any[]): void
  debug(message: ConsolaLogObject | any, ...args: any[]): void
  trace(message: ConsolaLogObject | any, ...args: any[]): void
 
  // Create
  create(options: ConsolaOptions): Consola
  withDefaults(defaults: ConsolaLogObject): Consola
 
  withTag(tag: string): Consola
  withScope(tag: string): Consola
 
  // Reporter
  addReporter(reporter: ConsolaReporter): Consola
  setReporters(reporters: Array<ConsolaReporter>): Consola
 
  removeReporter(reporter?: ConsolaReporter): Consola
  remove(reporter?: ConsolaReporter): Consola
  clear(reporter?: ConsolaReporter): Consola
 
  // Wrappers
  wrapAll(): void
  restoreAll(): void
  wrapConsole(): void
  restoreConsole(): void
  wrapStd(): void
  restoreStd(): void
 
  // Pause/Resume
  pauseLogs(): void
  pause(): void
 
  resumeLogs(): void
  resume(): void
 
  // Mock
  mockTypes(mockFn: ConsolaMockFn): any
  mock(mockFn: ConsolaMockFn): any
}
 
export interface BasicReporterOptions {
  dateFormat?: string;
  formatOptions?: InspectOptions;
}
 
export declare class BasicReporter implements ConsolaReporter {
  protected options: BasicReporterOptions;
 
  constructor(options?: BasicReporterOptions);
 
  public log(logObj: ConsolaReporterLogObject, args: ConsolaReporterArgs): void;
 
  protected formatStack(stack: string): string;
  protected formatArgs(args: any[]): string;
  protected formatDate(date: Date): string;
  protected filterAndJoin(arr: Array<string | undefined>): string;
  protected formatLogObj(logObj: ConsolaReporterLogObject): string;
}
 
export interface FancyReporterOptions extends BasicReporterOptions{
  secondaryColor?: string;
}
 
export declare class FancyReporter extends BasicReporter {
  constructor(options?: FancyReporterOptions);
 
  protected formatType(logObj: ConsolaReporterLogObject): void;
}
 
export type BrowserReporterOptions = {};
 
export declare class BrowserReporter implements ConsolaReporter {
  public log(logObj: ConsolaReporterLogObject, args: ConsolaReporterArgs): void;
}
 
export type JSONReporterOptions = {
  stream?: NodeJS.WritableStream;
};
 
export declare class JSONReporter implements ConsolaReporter {
  constructor(options?: JSONReporterOptions);
  public log(logObj: ConsolaReporterLogObject, args: ConsolaReporterArgs): void;
}
 
export type Winston = any;
 
export declare class WinstonReporter implements ConsolaReporter {
  constructor(logger?: Winston);
  public log(logObj: ConsolaReporterLogObject, args: ConsolaReporterArgs): void;
}
 
declare const consolaGlobalInstance: Consola;
 
export default consolaGlobalInstance