1 | import { Config } from './config';
|
2 | export declare enum LogLevel {
|
3 | ERROR = 0,
|
4 | WARN = 1,
|
5 | INFO = 2,
|
6 | DEBUG = 3,
|
7 | }
|
8 | export declare enum WriteTo {
|
9 | CONSOLE = 0,
|
10 | FILE = 1,
|
11 | BOTH = 2,
|
12 | NONE = 3,
|
13 | }
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | export declare class Logger {
|
19 | private id;
|
20 | static logLevel: LogLevel;
|
21 | static showTimestamp: boolean;
|
22 | static showId: boolean;
|
23 | static writeTo: WriteTo;
|
24 | static fd: any;
|
25 | static firstWrite: boolean;
|
26 | |
27 |
|
28 |
|
29 |
|
30 | static set(config: Config): void;
|
31 | |
32 |
|
33 |
|
34 |
|
35 |
|
36 | static setWrite(writeTo: WriteTo, opt_logFile?: string): void;
|
37 | |
38 |
|
39 |
|
40 |
|
41 | constructor(id: string);
|
42 | /**
|
43 | * Log INFO
|
44 | * @param ...msgs multiple arguments to be logged.
|
45 | */
|
46 | info(...msgs: any[]): void;
|
47 | /**
|
48 | * Log DEBUG
|
49 | * @param ...msgs multiple arguments to be logged.
|
50 | */
|
51 | debug(...msgs: any[]): void;
|
52 | /**
|
53 | * Log WARN
|
54 | * @param ...msgs multiple arguments to be logged.
|
55 | */
|
56 | warn(...msgs: any[]): void;
|
57 | /**
|
58 | * Log ERROR
|
59 | * @param ...msgs multiple arguments to be logged.
|
60 | */
|
61 | error(...msgs: any[]): void;
|
62 | /**
|
63 | * For the log level set, check to see if the messages should be logged.
|
64 | * @param logLevel The log level of the message.
|
65 | * @param msgs The messages to be logged
|
66 | */
|
67 | log_(logLevel: LogLevel, msgs: any[]): void;
|
68 | /**
|
69 | * Format with timestamp, log level, identifier, and message and log to
|
70 | * specified medium (console, file, both, none).
|
71 | * @param logLevel The log level of the message.
|
72 | * @param msgs The messages to be logged.
|
73 | */
|
74 | print_(logLevel: LogLevel, msgs: any[]): void;
|
75 | /**
|
76 | * Get a timestamp formatted with [hh:mm:ss]
|
77 | * @param writeTo The enum for where to write the logs.
|
78 | * @return The string of the formatted timestamp
|
79 | */
|
80 | static timestamp_(writeTo: WriteTo): string;
|
81 | /**
|
82 | * Get the identifier of the logger as '/<id>'
|
83 | * @param logLevel The log level of the message.
|
84 | * @param writeTo The enum for where to write the logs.
|
85 | * @return The string of the formatted id
|
86 | */
|
87 | static id_(logLevel: LogLevel, id: string, writeTo: WriteTo): string;
|
88 | /**
|
89 | * Get the log level formatted with the first letter. For info, it is I.
|
90 | * @param logLevel The log level of the message.
|
91 | * @param writeTo The enum for where to write the logs.
|
92 | * @return The string of the formatted log level
|
93 | */
|
94 | static level_(logLevel: LogLevel, id: string, writeTo: WriteTo): string;
|
95 | /**
|
96 | * Convert the list of messages to a single string message.
|
97 | * @param msgs The list of messages.
|
98 | * @return The string of the formatted messages
|
99 | */
|
100 | static msgToFile_(msgs: any[]): string;
|
101 | }
|