-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.d.ts
95 lines (84 loc) · 2.28 KB
/
index.d.ts
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
export as namespace log4ts;
export class Logger {
constructor(tag?: string);
log(message: string, object?: any, deep?: number): void;
info(message: string, object?: any, deep?: number): void;
fatal(message: string, object?: any, deep?: number): void;
error(message: string, object?: any, deep?: number): void;
debug(message: string, object?: any, deep?: number): void;
warn(message: string, object?: any, deep?: number): void;
trace(message: string, object?: any, deep?: number): void;
static setConfig(config: LoggerConfig): void;
static getLogger(tag?: string): any;
}
export class LoggerConfig {
constructor(appender?: IAppender, level?: LogLevel, tags?: string[]);
addAppender(appender: IAppender): void;
setLevel(level: LogLevel): void;
getAppenders(): IAppender[];
getLevel(): LogLevel;
hasTag(tag: string): boolean;
static createFromJson(json: ConfigJson): LoggerConfig;
}
/*
INTERFACES
*/
export interface IAppender {
setLayout(layout: ILayout): void;
setLayoutFunction(layout: ILayoutFunction): void;
append(entry: LogEntry): void;
clear(): void;
}
export interface ILayout {
format(entry: LogEntry): string;
}
export interface ILayoutFunction {
(entry: LogEntry): string;
}
export interface LogEntry {
level: LogLevel;
time: Date;
message: string;
tag: string;
}
export enum LogLevel {
ALL = 0,
TRACE = 1,
DEBUG = 2,
INFO = 3,
WARN = 4,
ERROR = 5,
FATAL = 6,
OFF = 7,
}
/*
CONFIG JSON
*/
export interface ConfigJson {
layouts: ConfigJsonLayout[];
level: "ALL" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR" | "FATAL" | "OFF";
tags: string[];
}
export interface ConfigJsonLayout {
type: "basic" | "html";
appenders: ConfigJsonAppender[];
options?: ConfigHtmlLayoutOptions;
}
export interface ConfigHtmlLayoutOptions {
color_scheme?: "LIGHT" | "DARK" | "SOLARIZED" | HTMLLayoutColors;
}
export interface ConfigJsonAppender {
type: "console" | "dom";
options?: ConfigJsonDomAppenderOptions;
}
export interface ConfigJsonDomAppenderOptions {
container_id: string;
escape_html?: boolean;
buffer_size?: number;
}
export interface HTMLLayoutColors {
tag: string;
message: string;
time: string;
level: string;
}