@creejs/commons-logging 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +291 -0
- package/index.js +3 -0
- package/lib/console/console-log-factory.js +76 -0
- package/lib/console/console-log-provider.js +29 -0
- package/lib/console/console-logger.js +88 -0
- package/lib/console/index.js +11 -0
- package/lib/index.js +257 -0
- package/lib/log-config.js +157 -0
- package/lib/log-factory.js +88 -0
- package/lib/log-level.js +163 -0
- package/lib/log4js/index.js +11 -0
- package/lib/log4js/log4js-6x-config.js +12 -0
- package/lib/log4js/log4js-factory.js +90 -0
- package/lib/log4js/log4js-logger.js +111 -0
- package/lib/log4js/log4js-provider.js +35 -0
- package/lib/logger.js +285 -0
- package/lib/provider-type.js +13 -0
- package/lib/provider.js +53 -0
- package/package.json +34 -0
- package/types/console-logger.d.ts +7 -0
- package/types/index.d.ts +22 -0
- package/types/log4js-logger.d.ts +13 -0
- package/types/logger.d.ts +111 -0
- package/types/logging-level.d.ts +41 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
export = Logger;
|
|
2
|
+
/**
|
|
3
|
+
* Interface of All Logger
|
|
4
|
+
* @abstract
|
|
5
|
+
*/
|
|
6
|
+
declare class Logger {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new ConsoleLog instance.
|
|
9
|
+
* @constructor
|
|
10
|
+
* @param {string} name - The name identifier for the logger
|
|
11
|
+
* @param {number} [level=1] - The logging level, default is {@link DefaultLevel} error:1
|
|
12
|
+
* @param {module} [providerLib] - The provider library
|
|
13
|
+
*/
|
|
14
|
+
constructor(name: string, level?: number, providerLib?: any);
|
|
15
|
+
_name: string;
|
|
16
|
+
level: number;
|
|
17
|
+
_providerLib: any;
|
|
18
|
+
/**
|
|
19
|
+
* Gets the name of the logger instance.
|
|
20
|
+
* @returns {string} The name of the logger.
|
|
21
|
+
*/
|
|
22
|
+
get name(): string;
|
|
23
|
+
get fatalEnabled(): boolean;
|
|
24
|
+
get errorEnabled(): boolean;
|
|
25
|
+
get warnEnabled(): boolean;
|
|
26
|
+
get debugEnabled(): boolean;
|
|
27
|
+
get infoEnabled(): boolean;
|
|
28
|
+
get traceEnabled(): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Logs a fatal error message with timestamp and logger name.
|
|
31
|
+
* Only outputs if fatal logging is enabled for this logger instance.
|
|
32
|
+
* @param {...any} args - Arguments to log (will be space-separated)
|
|
33
|
+
*/
|
|
34
|
+
fatal(...args: any[]): void;
|
|
35
|
+
/**
|
|
36
|
+
* Override this method to implement fatal logging.
|
|
37
|
+
* @public
|
|
38
|
+
* @param {...*} args - Variable arguments
|
|
39
|
+
* @throws {Error} Always throws "Not Implemented Yet" error
|
|
40
|
+
*/
|
|
41
|
+
public _fatal(...args: any[]): void;
|
|
42
|
+
/**
|
|
43
|
+
* Logs an error message to the console with timestamp and logger name.
|
|
44
|
+
* Only logs if error logging is enabled for this logger instance.
|
|
45
|
+
* @param {...any} args - Arguments to be logged as error message
|
|
46
|
+
*/
|
|
47
|
+
error(...args: any[]): void;
|
|
48
|
+
/**
|
|
49
|
+
* Override this method to implement error logging.
|
|
50
|
+
* @public
|
|
51
|
+
* @param {...*} args - Variable arguments
|
|
52
|
+
* @throws {Error} Always throws "Not Implemented Yet" error
|
|
53
|
+
*/
|
|
54
|
+
public _error(...args: any[]): void;
|
|
55
|
+
/**
|
|
56
|
+
* Logs a warning message to the console if warn logging is enabled.
|
|
57
|
+
* @param {...any} args - The arguments to log as a warning message.
|
|
58
|
+
*/
|
|
59
|
+
warn(...args: any[]): void;
|
|
60
|
+
/**
|
|
61
|
+
* Override this method to implement warn logging.
|
|
62
|
+
* @public
|
|
63
|
+
* @param {...*} args - Variable arguments
|
|
64
|
+
* @throws {Error} Always throws "Not Implemented Yet" error
|
|
65
|
+
*/
|
|
66
|
+
public _warn(...args: any[]): void;
|
|
67
|
+
/**
|
|
68
|
+
* Logs debug messages to console if debug mode is enabled.
|
|
69
|
+
* @param {...any} args - The data to be logged
|
|
70
|
+
*/
|
|
71
|
+
debug(...args: any[]): void;
|
|
72
|
+
/**
|
|
73
|
+
* Override this method to implement debug logging.
|
|
74
|
+
* @public
|
|
75
|
+
* @param {...*} args - Variable arguments
|
|
76
|
+
* @throws {Error} Always throws "Not Implemented Yet" error
|
|
77
|
+
*/
|
|
78
|
+
public _debug(...args: any[]): void;
|
|
79
|
+
/**
|
|
80
|
+
* Logs an info message to the console with timestamp and logger name.
|
|
81
|
+
* @param {...any} args - The data to be logged. Accepts multiple arguments.
|
|
82
|
+
* @example
|
|
83
|
+
* logger.info('Service started', { port: 3000 });
|
|
84
|
+
*/
|
|
85
|
+
info(...args: any[]): void;
|
|
86
|
+
/**
|
|
87
|
+
* Override this method to implement info logging.
|
|
88
|
+
* @public
|
|
89
|
+
* @param {...*} args - Variable arguments
|
|
90
|
+
* @throws {Error} Always throws "Not Implemented Yet" error
|
|
91
|
+
*/
|
|
92
|
+
public _info(...args: any[]): void;
|
|
93
|
+
/**
|
|
94
|
+
* Logs a trace message with timestamp and logger name if trace logging is enabled.
|
|
95
|
+
* @param {...any} args - Data to be logged as trace message.
|
|
96
|
+
*/
|
|
97
|
+
trace(...args: any[]): void;
|
|
98
|
+
/**
|
|
99
|
+
* Override this method to implement trace logging.
|
|
100
|
+
* @public
|
|
101
|
+
* @param {...*} args - Variable arguments
|
|
102
|
+
* @throws {Error} Always throws "Not Implemented Yet" error
|
|
103
|
+
*/
|
|
104
|
+
public _trace(...args: any[]): void;
|
|
105
|
+
isFatalEnabled(): boolean;
|
|
106
|
+
isErrorEnabled(): boolean;
|
|
107
|
+
isWarnEnabled(): boolean;
|
|
108
|
+
isDebugEnabled(): boolean;
|
|
109
|
+
isInfoEnabled(): boolean;
|
|
110
|
+
isTraceEnabled(): boolean;
|
|
111
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard logging level names
|
|
3
|
+
* @type {Object.<string, string>}
|
|
4
|
+
*/
|
|
5
|
+
export const Names: {
|
|
6
|
+
[x: string]: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* *
|
|
10
|
+
*/
|
|
11
|
+
export type Level = number;
|
|
12
|
+
export namespace Level {
|
|
13
|
+
let OFF: number;
|
|
14
|
+
let FATAL: number;
|
|
15
|
+
let ERROR: number;
|
|
16
|
+
let WARN: number;
|
|
17
|
+
let INFO: number;
|
|
18
|
+
let DEBUG: number;
|
|
19
|
+
let TRACE: number;
|
|
20
|
+
let ALL: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The default logging level (ERROR)
|
|
24
|
+
* @type {number}
|
|
25
|
+
*/
|
|
26
|
+
export const DefaultLevel: number;
|
|
27
|
+
/**
|
|
28
|
+
* Converts a numeric logging level value to its corresponding name.
|
|
29
|
+
* @param {number} value - The numeric logging level value to convert.
|
|
30
|
+
* @returns {string|undefined} The name associated with the given logging level value.
|
|
31
|
+
* @memberof LoggingLevel
|
|
32
|
+
*/
|
|
33
|
+
export function value2Name(value: number): string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Converts a logging level name to its corresponding numeric value.
|
|
36
|
+
* @param {string} name - The name of the logging level.
|
|
37
|
+
* @returns {number|undefined} The numeric value of the logging level, or undefined if name is not supported.
|
|
38
|
+
* @memberof LoggingLevel
|
|
39
|
+
*/
|
|
40
|
+
export function name2Value(name: string): number | undefined;
|
|
41
|
+
export { Names as LevelNames, Level as LevelValue };
|