@athenna/logger 1.0.4 → 1.0.7
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/index.d.ts +0 -1
- package/index.js +0 -1
- package/package.json +3 -1
- package/src/Drivers/ConsoleDriver.d.ts +2 -2
- package/src/Drivers/ConsoleDriver.js +3 -5
- package/src/Drivers/DebugDriver.d.ts +2 -2
- package/src/Drivers/DebugDriver.js +3 -5
- package/src/Drivers/FileDriver.d.ts +2 -2
- package/src/Drivers/FileDriver.js +3 -5
- package/src/Logger.d.ts +10 -9
- package/src/Logger.js +72 -72
- package/src/Providers/LoggerProvider.d.ts +17 -0
- package/src/Providers/LoggerProvider.js +24 -0
- package/src/Log.d.ts +0 -18
- package/src/Log.js +0 -79
- package/src/Utils/global.d.ts +0 -15
- package/src/Utils/global.js +0 -15
package/index.d.ts
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* For the full copyright and license information, please view the LICENSE
|
|
7
7
|
* file that was distributed with this source code.
|
|
8
8
|
*/
|
|
9
|
-
export * from './src/Log';
|
|
10
9
|
export * from './src/Logger';
|
|
11
10
|
export * from './src/Contracts/DriverContract';
|
|
12
11
|
export * from './src/Contracts/FormatterContract';
|
package/index.js
CHANGED
|
@@ -18,7 +18,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
18
18
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
__exportStar(require("./src/Log"), exports);
|
|
22
21
|
__exportStar(require("./src/Logger"), exports);
|
|
23
22
|
__exportStar(require("./src/Contracts/DriverContract"), exports);
|
|
24
23
|
__exportStar(require("./src/Contracts/FormatterContract"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@athenna/logger",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "João Lenon <lenon@athenna.io>",
|
|
@@ -130,6 +130,7 @@
|
|
|
130
130
|
"@typescript-eslint/interface-name-prefix": "off",
|
|
131
131
|
"@typescript-eslint/no-explicit-any": "off",
|
|
132
132
|
"prettier/prettier": "error",
|
|
133
|
+
"@typescript-eslint/no-empty-function": "off",
|
|
133
134
|
"@typescript-eslint/no-unused-vars": [
|
|
134
135
|
"error",
|
|
135
136
|
{
|
|
@@ -152,6 +153,7 @@
|
|
|
152
153
|
}
|
|
153
154
|
},
|
|
154
155
|
"dependencies": {
|
|
156
|
+
"@athenna/ioc": "1.0.9",
|
|
155
157
|
"@secjs/utils": "1.8.0",
|
|
156
158
|
"reflect-metadata": "0.1.13",
|
|
157
159
|
"tscpaths": "0.0.9"
|
|
@@ -14,12 +14,12 @@ export interface ConsoleDriverOpts {
|
|
|
14
14
|
context: string;
|
|
15
15
|
formatter: string;
|
|
16
16
|
streamType: string;
|
|
17
|
+
formatterConfig: any;
|
|
17
18
|
}
|
|
18
19
|
export declare class ConsoleDriver implements DriverContract {
|
|
19
|
-
private readonly _level;
|
|
20
|
-
private readonly _context;
|
|
21
20
|
private readonly _formatter;
|
|
22
21
|
private readonly _streamType;
|
|
22
|
+
private readonly _formatterConfig;
|
|
23
23
|
constructor(channel: string, configs?: any);
|
|
24
24
|
transport(message: string, options?: ConsoleDriverOpts): void;
|
|
25
25
|
}
|
|
@@ -14,19 +14,17 @@ const FormatterFactory_1 = require("../Factories/FormatterFactory");
|
|
|
14
14
|
class ConsoleDriver {
|
|
15
15
|
constructor(channel, configs = {}) {
|
|
16
16
|
const channelConfig = utils_1.Config.get(`logging.channels.${channel}`);
|
|
17
|
-
this._level = configs.level || channelConfig.level;
|
|
18
|
-
this._context = configs.context || channelConfig.context;
|
|
19
17
|
this._formatter = configs.formatter || channelConfig.formatter;
|
|
20
18
|
this._streamType = configs.streamType || channelConfig.streamType;
|
|
19
|
+
this._formatterConfig =
|
|
20
|
+
configs.formatterConfig || channelConfig.formatterConfig;
|
|
21
21
|
}
|
|
22
22
|
transport(message, options) {
|
|
23
23
|
options = Object.assign({}, {
|
|
24
|
-
level: this._level,
|
|
25
|
-
context: this._context,
|
|
26
24
|
formatter: this._formatter,
|
|
27
25
|
streamType: this._streamType,
|
|
28
26
|
}, options);
|
|
29
|
-
message = FormatterFactory_1.FormatterFactory.fabricate(options.formatter).format(message, options);
|
|
27
|
+
message = FormatterFactory_1.FormatterFactory.fabricate(options.formatter).format(message, options.formatterConfig || this._formatterConfig);
|
|
30
28
|
process[options.streamType].write(`${message}\n`);
|
|
31
29
|
}
|
|
32
30
|
}
|
|
@@ -14,12 +14,12 @@ export interface DebugDriverOpts {
|
|
|
14
14
|
context: string;
|
|
15
15
|
formatter: string;
|
|
16
16
|
namespace: string;
|
|
17
|
+
formatterConfig: any;
|
|
17
18
|
}
|
|
18
19
|
export declare class DebugDriver implements DriverContract {
|
|
19
|
-
private readonly _level;
|
|
20
|
-
private readonly _context;
|
|
21
20
|
private readonly _formatter;
|
|
22
21
|
private readonly _namespace;
|
|
22
|
+
private readonly _formatterConfig;
|
|
23
23
|
constructor(channel: string, configs?: any);
|
|
24
24
|
transport(message: string, options?: DebugDriverOpts): void;
|
|
25
25
|
}
|
|
@@ -15,19 +15,17 @@ const FormatterFactory_1 = require("../Factories/FormatterFactory");
|
|
|
15
15
|
class DebugDriver {
|
|
16
16
|
constructor(channel, configs = {}) {
|
|
17
17
|
const channelConfig = utils_1.Config.get(`logging.channels.${channel}`);
|
|
18
|
-
this._level = configs.level || channelConfig.level;
|
|
19
|
-
this._context = configs.context || channelConfig.context;
|
|
20
18
|
this._formatter = configs.formatter || channelConfig.formatter;
|
|
21
19
|
this._namespace = configs.namespace || channelConfig.namespace;
|
|
20
|
+
this._formatterConfig =
|
|
21
|
+
configs.formatterConfig || channelConfig.formatterConfig;
|
|
22
22
|
}
|
|
23
23
|
transport(message, options) {
|
|
24
24
|
options = Object.assign({}, {
|
|
25
|
-
level: this._level,
|
|
26
|
-
context: this._context,
|
|
27
25
|
formatter: this._formatter,
|
|
28
26
|
namespace: this._namespace,
|
|
29
27
|
}, options);
|
|
30
|
-
message = FormatterFactory_1.FormatterFactory.fabricate(options.formatter).format(message, options);
|
|
28
|
+
message = FormatterFactory_1.FormatterFactory.fabricate(options.formatter).format(message, options.formatterConfig || this._formatterConfig);
|
|
31
29
|
debug_1.debug(options.namespace)(message);
|
|
32
30
|
}
|
|
33
31
|
}
|
|
@@ -12,12 +12,12 @@ export interface FileDriverOpts {
|
|
|
12
12
|
context: string;
|
|
13
13
|
formatter: string;
|
|
14
14
|
filePath: string;
|
|
15
|
+
formatterConfig: any;
|
|
15
16
|
}
|
|
16
17
|
export declare class FileDriver implements DriverContract {
|
|
17
|
-
private readonly _level;
|
|
18
|
-
private readonly _context;
|
|
19
18
|
private readonly _filePath;
|
|
20
19
|
private readonly _formatter;
|
|
20
|
+
private readonly _formatterConfig;
|
|
21
21
|
constructor(channel: string, configs?: any);
|
|
22
22
|
transport(message: string, options?: FileDriverOpts): Promise<void>;
|
|
23
23
|
}
|
|
@@ -17,15 +17,13 @@ const FormatterFactory_1 = require("../Factories/FormatterFactory");
|
|
|
17
17
|
class FileDriver {
|
|
18
18
|
constructor(channel, configs = {}) {
|
|
19
19
|
const channelConfig = utils_1.Config.get(`logging.channels.${channel}`);
|
|
20
|
-
this._level = configs.level || channelConfig.level;
|
|
21
|
-
this._context = configs.context || channelConfig.context;
|
|
22
20
|
this._filePath = configs.filePath || channelConfig.filePath;
|
|
23
21
|
this._formatter = configs.formatter || channelConfig.formatter;
|
|
22
|
+
this._formatterConfig =
|
|
23
|
+
configs.formatterConfig || channelConfig.formatterConfig;
|
|
24
24
|
}
|
|
25
25
|
async transport(message, options) {
|
|
26
26
|
options = Object.assign({}, {
|
|
27
|
-
level: this._level,
|
|
28
|
-
context: this._context,
|
|
29
27
|
filePath: this._filePath,
|
|
30
28
|
formatter: this._formatter,
|
|
31
29
|
}, options);
|
|
@@ -34,7 +32,7 @@ class FileDriver {
|
|
|
34
32
|
if (!fs_1.existsSync(dir)) {
|
|
35
33
|
fs_1.mkdirSync(dir, { recursive: true });
|
|
36
34
|
}
|
|
37
|
-
message = FormatterFactory_1.FormatterFactory.fabricate(options.formatter).format(message, options);
|
|
35
|
+
message = FormatterFactory_1.FormatterFactory.fabricate(options.formatter).format(message, options.formatterConfig || this._formatterConfig);
|
|
38
36
|
return new Promise((resolve, reject) => {
|
|
39
37
|
const stream = fs_1.createWriteStream(filePath, { flags: 'a' });
|
|
40
38
|
stream.write(`${Color_1.Color.removeColors(message)}` + '\n');
|
package/src/Logger.d.ts
CHANGED
|
@@ -4,16 +4,17 @@ export declare class Logger {
|
|
|
4
4
|
private runtimeConfig;
|
|
5
5
|
private channelName;
|
|
6
6
|
private driver;
|
|
7
|
-
|
|
8
|
-
static buildFormatter(name: string, formatter: new () => FormatterContract): void;
|
|
7
|
+
constructor(runtimeConfig?: any);
|
|
9
8
|
static get drivers(): string[];
|
|
10
9
|
static get formatters(): string[];
|
|
11
|
-
|
|
10
|
+
static buildDriver(name: string, driver: new (channel: string, configs?: any) => DriverContract): void;
|
|
11
|
+
static buildFormatter(name: string, formatter: new () => FormatterContract): void;
|
|
12
12
|
channel(channel: string, runtimeConfig?: any): Logger;
|
|
13
|
-
log(message: any, options?:
|
|
14
|
-
info(message: any, options?:
|
|
15
|
-
warn(message: any, options?:
|
|
16
|
-
error(message: any, options?:
|
|
17
|
-
debug(message: any, options?:
|
|
18
|
-
success(message: any, options?:
|
|
13
|
+
log(message: any, options?: {}): void | Promise<void>;
|
|
14
|
+
info(message: any, options?: {}): void | Promise<void>;
|
|
15
|
+
warn(message: any, options?: {}): void | Promise<void>;
|
|
16
|
+
error(message: any, options?: {}): void | Promise<void>;
|
|
17
|
+
debug(message: any, options?: {}): void | Promise<void>;
|
|
18
|
+
success(message: any, options?: {}): void | Promise<void>;
|
|
19
|
+
private createOptions;
|
|
19
20
|
}
|
package/src/Logger.js
CHANGED
|
@@ -12,98 +12,98 @@ class Logger {
|
|
|
12
12
|
this.channelName = 'default';
|
|
13
13
|
this.driver = DriverFactory_1.DriverFactory.fabricate(this.channelName, this.runtimeConfig);
|
|
14
14
|
}
|
|
15
|
-
static buildDriver(name, driver) {
|
|
16
|
-
DriverFactory_1.DriverFactory.createDriver(name, driver);
|
|
17
|
-
}
|
|
18
|
-
static buildFormatter(name, formatter) {
|
|
19
|
-
FormatterFactory_1.FormatterFactory.createFormatter(name, formatter);
|
|
20
|
-
}
|
|
21
15
|
static get drivers() {
|
|
22
16
|
return DriverFactory_1.DriverFactory.availableDrivers();
|
|
23
17
|
}
|
|
24
18
|
static get formatters() {
|
|
25
19
|
return FormatterFactory_1.FormatterFactory.availableFormatters();
|
|
26
20
|
}
|
|
21
|
+
static buildDriver(name, driver) {
|
|
22
|
+
DriverFactory_1.DriverFactory.createDriver(name, driver);
|
|
23
|
+
}
|
|
24
|
+
static buildFormatter(name, formatter) {
|
|
25
|
+
FormatterFactory_1.FormatterFactory.createFormatter(name, formatter);
|
|
26
|
+
}
|
|
27
27
|
channel(channel, runtimeConfig) {
|
|
28
28
|
if (runtimeConfig)
|
|
29
29
|
this.runtimeConfig = runtimeConfig;
|
|
30
30
|
this.driver = DriverFactory_1.DriverFactory.fabricate(channel, this.runtimeConfig);
|
|
31
31
|
return this;
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
options =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
...this.runtimeConfig.formatterConfig,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
await this.driver.transport(message, options);
|
|
33
|
+
log(message, options = {}) {
|
|
34
|
+
options = this.createOptions(options, {
|
|
35
|
+
streamType: 'stdout',
|
|
36
|
+
});
|
|
37
|
+
return this.driver.transport(message, options);
|
|
42
38
|
}
|
|
43
|
-
|
|
44
|
-
options =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
await this.driver.transport(message, options);
|
|
39
|
+
info(message, options = {}) {
|
|
40
|
+
options = this.createOptions(options, {
|
|
41
|
+
streamType: 'stdout',
|
|
42
|
+
formatterConfig: {
|
|
43
|
+
level: 'INFO',
|
|
44
|
+
color: Color_1.Color.cyan,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
return this.driver.transport(message, options);
|
|
55
48
|
}
|
|
56
|
-
|
|
57
|
-
options =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
await this.driver.transport(message, options);
|
|
49
|
+
warn(message, options = {}) {
|
|
50
|
+
options = this.createOptions(options, {
|
|
51
|
+
streamType: 'stdout',
|
|
52
|
+
formatterConfig: {
|
|
53
|
+
level: 'WARN',
|
|
54
|
+
color: Color_1.Color.orange,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
return this.driver.transport(message, options);
|
|
68
58
|
}
|
|
69
|
-
|
|
70
|
-
options =
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
await this.driver.transport(message, options);
|
|
59
|
+
error(message, options = {}) {
|
|
60
|
+
options = this.createOptions(options, {
|
|
61
|
+
streamType: 'stdout',
|
|
62
|
+
formatterConfig: {
|
|
63
|
+
level: 'ERROR',
|
|
64
|
+
color: Color_1.Color.red,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
return this.driver.transport(message, options);
|
|
81
68
|
}
|
|
82
|
-
|
|
83
|
-
options =
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
69
|
+
debug(message, options = {}) {
|
|
70
|
+
options = this.createOptions(options, {
|
|
71
|
+
streamType: 'stdout',
|
|
72
|
+
formatterConfig: {
|
|
73
|
+
level: 'DEBUG',
|
|
74
|
+
color: Color_1.Color.purple,
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
return this.driver.transport(message, options);
|
|
78
|
+
}
|
|
79
|
+
success(message, options = {}) {
|
|
80
|
+
options = this.createOptions(options, {
|
|
81
|
+
streamType: 'stdout',
|
|
82
|
+
formatterConfig: {
|
|
83
|
+
level: 'SUCCESS',
|
|
84
|
+
color: Color_1.Color.green,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
return this.driver.transport(message, options);
|
|
94
88
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
options.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
options = {
|
|
102
|
-
...options,
|
|
89
|
+
createOptions(options, defaultValues) {
|
|
90
|
+
let formatterConfig = Object.assign({}, {
|
|
91
|
+
...defaultValues.formatterConfig,
|
|
92
|
+
}, options.formatterConfig);
|
|
93
|
+
if (this.runtimeConfig.formatterConfig) {
|
|
94
|
+
formatterConfig = {
|
|
103
95
|
...this.runtimeConfig.formatterConfig,
|
|
96
|
+
...formatterConfig,
|
|
104
97
|
};
|
|
105
98
|
}
|
|
106
|
-
|
|
99
|
+
options = Object.assign({}, {
|
|
100
|
+
streamType: 'stdout',
|
|
101
|
+
}, options);
|
|
102
|
+
options = {
|
|
103
|
+
...options,
|
|
104
|
+
formatterConfig,
|
|
105
|
+
};
|
|
106
|
+
return options;
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
exports.Logger = Logger;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @athenna/logger
|
|
3
|
+
*
|
|
4
|
+
* (c) João Lenon <lenon@athenna.io>
|
|
5
|
+
*
|
|
6
|
+
* For the full copyright and license information, please view the LICENSE
|
|
7
|
+
* file that was distributed with this source code.
|
|
8
|
+
*/
|
|
9
|
+
import { ServiceProvider } from '@athenna/ioc';
|
|
10
|
+
export declare class LoggerProvider extends ServiceProvider {
|
|
11
|
+
/**
|
|
12
|
+
* Register any application services.
|
|
13
|
+
*
|
|
14
|
+
* @return void
|
|
15
|
+
*/
|
|
16
|
+
register(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @athenna/logger
|
|
4
|
+
*
|
|
5
|
+
* (c) João Lenon <lenon@athenna.io>
|
|
6
|
+
*
|
|
7
|
+
* For the full copyright and license information, please view the LICENSE
|
|
8
|
+
* file that was distributed with this source code.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.LoggerProvider = void 0;
|
|
12
|
+
const Logger_1 = require("../Logger");
|
|
13
|
+
const ioc_1 = require("@athenna/ioc");
|
|
14
|
+
class LoggerProvider extends ioc_1.ServiceProvider {
|
|
15
|
+
/**
|
|
16
|
+
* Register any application services.
|
|
17
|
+
*
|
|
18
|
+
* @return void
|
|
19
|
+
*/
|
|
20
|
+
register() {
|
|
21
|
+
this.container.bind('Athenna/Core/Logger', Logger_1.Logger);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.LoggerProvider = LoggerProvider;
|
package/src/Log.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { DriverContract } from './Contracts/DriverContract';
|
|
2
|
-
import { FormatterContract } from './Contracts/FormatterContract';
|
|
3
|
-
export declare class Log {
|
|
4
|
-
private static _options?;
|
|
5
|
-
private static logger;
|
|
6
|
-
static options(options?: any): void;
|
|
7
|
-
static buildDriver(name: string, driver: new (channel: string, configs?: any) => DriverContract): typeof Log;
|
|
8
|
-
static buildFormatter(name: string, formatter: new () => FormatterContract): typeof Log;
|
|
9
|
-
static get drivers(): string[];
|
|
10
|
-
static get formatters(): string[];
|
|
11
|
-
static channel(channel: string): typeof Log;
|
|
12
|
-
static log(message: any, options?: any): void;
|
|
13
|
-
static info(message: any, options?: any): void;
|
|
14
|
-
static warn(message: any, options?: any): void;
|
|
15
|
-
static error(message: any, options?: any): void;
|
|
16
|
-
static debug(message: any, options?: any): void;
|
|
17
|
-
static success(message: any, options?: any): void;
|
|
18
|
-
}
|
package/src/Log.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Log = void 0;
|
|
4
|
-
const Logger_1 = require("./Logger");
|
|
5
|
-
class Log {
|
|
6
|
-
static options(options) {
|
|
7
|
-
this._options = options;
|
|
8
|
-
}
|
|
9
|
-
static buildDriver(name, driver) {
|
|
10
|
-
Logger_1.Logger.buildDriver(name, driver);
|
|
11
|
-
return this;
|
|
12
|
-
}
|
|
13
|
-
static buildFormatter(name, formatter) {
|
|
14
|
-
Logger_1.Logger.buildFormatter(name, formatter);
|
|
15
|
-
return this;
|
|
16
|
-
}
|
|
17
|
-
static get drivers() {
|
|
18
|
-
return Logger_1.Logger.drivers;
|
|
19
|
-
}
|
|
20
|
-
static get formatters() {
|
|
21
|
-
return Logger_1.Logger.formatters;
|
|
22
|
-
}
|
|
23
|
-
static channel(channel) {
|
|
24
|
-
if (!this.logger)
|
|
25
|
-
this.logger = new Logger_1.Logger();
|
|
26
|
-
this.logger.channel(channel);
|
|
27
|
-
return this;
|
|
28
|
-
}
|
|
29
|
-
static log(message, options) {
|
|
30
|
-
options = {
|
|
31
|
-
...options,
|
|
32
|
-
...this._options,
|
|
33
|
-
};
|
|
34
|
-
this.logger.log(message, options);
|
|
35
|
-
this.logger = new Logger_1.Logger();
|
|
36
|
-
}
|
|
37
|
-
static info(message, options) {
|
|
38
|
-
options = {
|
|
39
|
-
...options,
|
|
40
|
-
...this._options,
|
|
41
|
-
};
|
|
42
|
-
this.logger.info(message, options);
|
|
43
|
-
this.logger = new Logger_1.Logger();
|
|
44
|
-
}
|
|
45
|
-
static warn(message, options) {
|
|
46
|
-
options = {
|
|
47
|
-
...options,
|
|
48
|
-
...this._options,
|
|
49
|
-
};
|
|
50
|
-
this.logger.warn(message, options);
|
|
51
|
-
this.logger = new Logger_1.Logger();
|
|
52
|
-
}
|
|
53
|
-
static error(message, options) {
|
|
54
|
-
options = {
|
|
55
|
-
...options,
|
|
56
|
-
...this._options,
|
|
57
|
-
};
|
|
58
|
-
this.logger.error(message, options);
|
|
59
|
-
this.logger = new Logger_1.Logger();
|
|
60
|
-
}
|
|
61
|
-
static debug(message, options) {
|
|
62
|
-
options = {
|
|
63
|
-
...options,
|
|
64
|
-
...this._options,
|
|
65
|
-
};
|
|
66
|
-
this.logger.debug(message, options);
|
|
67
|
-
this.logger = new Logger_1.Logger();
|
|
68
|
-
}
|
|
69
|
-
static success(message, options) {
|
|
70
|
-
options = {
|
|
71
|
-
...options,
|
|
72
|
-
...this._options,
|
|
73
|
-
};
|
|
74
|
-
this.logger.success(message, options);
|
|
75
|
-
this.logger = new Logger_1.Logger();
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
exports.Log = Log;
|
|
79
|
-
Log._options = {};
|
package/src/Utils/global.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @athenna/logger
|
|
3
|
-
*
|
|
4
|
-
* (c) João Lenon <lenon@athenna.io>
|
|
5
|
-
*
|
|
6
|
-
* For the full copyright and license information, please view the LICENSE
|
|
7
|
-
* file that was distributed with this source code.
|
|
8
|
-
*/
|
|
9
|
-
import { Log as LogFunction } from '../Log';
|
|
10
|
-
import { Logger as LoggerClass } from '../Logger';
|
|
11
|
-
export {};
|
|
12
|
-
declare global {
|
|
13
|
-
const Log: typeof LogFunction;
|
|
14
|
-
const Logger: typeof LoggerClass;
|
|
15
|
-
}
|
package/src/Utils/global.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @athenna/logger
|
|
4
|
-
*
|
|
5
|
-
* (c) João Lenon <lenon@athenna.io>
|
|
6
|
-
*
|
|
7
|
-
* For the full copyright and license information, please view the LICENSE
|
|
8
|
-
* file that was distributed with this source code.
|
|
9
|
-
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
const Log_1 = require("../Log");
|
|
12
|
-
const Logger_1 = require("../Logger");
|
|
13
|
-
const _global = global;
|
|
14
|
-
_global.Log = Log_1.Log;
|
|
15
|
-
_global.Logger = Logger_1.Logger;
|