@athenna/logger 1.1.8 → 1.2.1
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/LICENSE.md +3 -15
- package/README.md +6 -6
- package/package.json +87 -106
- package/src/Drivers/ConsoleDriver.js +43 -17
- package/src/Drivers/DebugDriver.js +45 -18
- package/src/Drivers/DiscordDriver.js +48 -25
- package/src/Drivers/FileDriver.js +51 -29
- package/src/Drivers/NullDriver.js +19 -7
- package/src/Drivers/PinoDriver.js +83 -61
- package/src/Drivers/SlackDriver.js +45 -22
- package/src/Drivers/TelegramDriver.js +44 -21
- package/src/Exceptions/DriverExistException.js +31 -0
- package/src/Exceptions/FormatterExistException.js +32 -0
- package/src/Exceptions/NotFoundChannelException.js +32 -0
- package/src/Exceptions/NotFoundDriverException.js +22 -10
- package/src/Exceptions/NotFoundFormatterException.js +22 -10
- package/src/Exceptions/OnlyPinoPrettyException.js +19 -10
- package/src/Facades/Log.js +9 -5
- package/src/Factories/DriverFactory.js +98 -56
- package/src/Factories/FormatterFactory.js +67 -37
- package/src/Formatters/CliFormatter.js +21 -22
- package/src/Formatters/JsonFormatter.js +15 -10
- package/src/Formatters/MessageFormatter.js +30 -33
- package/src/Formatters/NestFormatter.js +31 -22
- package/src/Formatters/NoneFormatter.js +21 -0
- package/src/Formatters/RequestFormatter.js +49 -37
- package/src/Formatters/SimpleFormatter.js +30 -33
- package/src/Helpers/ColorHelper.js +259 -0
- package/src/Helpers/FactoryHelper.js +121 -0
- package/src/Providers/LoggerProvider.js +13 -15
- package/src/index.d.ts +383 -0
- package/src/index.js +269 -0
- package/index.d.ts +0 -13
- package/index.js +0 -25
- package/src/Contracts/DefaultDriverConfigs.d.ts +0 -4
- package/src/Contracts/DefaultDriverConfigs.js +0 -2
- package/src/Contracts/DriverContract.d.ts +0 -13
- package/src/Contracts/DriverContract.js +0 -10
- package/src/Contracts/FormatterContract.d.ts +0 -11
- package/src/Contracts/FormatterContract.js +0 -10
- package/src/Contracts/LevelTypes.d.ts +0 -1
- package/src/Contracts/LevelTypes.js +0 -2
- package/src/Drivers/ConsoleDriver.d.ts +0 -19
- package/src/Drivers/DebugDriver.d.ts +0 -19
- package/src/Drivers/DiscordDriver.d.ts +0 -20
- package/src/Drivers/FileDriver.d.ts +0 -19
- package/src/Drivers/NullDriver.d.ts +0 -13
- package/src/Drivers/PinoDriver.d.ts +0 -20
- package/src/Drivers/SlackDriver.d.ts +0 -19
- package/src/Drivers/TelegramDriver.d.ts +0 -21
- package/src/Exceptions/ChannelNotConfiguredException.d.ts +0 -12
- package/src/Exceptions/ChannelNotConfiguredException.js +0 -19
- package/src/Exceptions/DriverAlreadyExistException.d.ts +0 -12
- package/src/Exceptions/DriverAlreadyExistException.js +0 -19
- package/src/Exceptions/FormatterAlreadyExistException.d.ts +0 -12
- package/src/Exceptions/FormatterAlreadyExistException.js +0 -19
- package/src/Exceptions/NotFoundDriverException.d.ts +0 -12
- package/src/Exceptions/NotFoundFormatterException.d.ts +0 -12
- package/src/Exceptions/OnlyPinoPrettyException.d.ts +0 -12
- package/src/Facades/Log.d.ts +0 -10
- package/src/Factories/DriverFactory.d.ts +0 -19
- package/src/Factories/FormatterFactory.d.ts +0 -18
- package/src/Formatters/CliFormatter.d.ts +0 -19
- package/src/Formatters/JsonFormatter.d.ts +0 -16
- package/src/Formatters/MessageFormatter.d.ts +0 -20
- package/src/Formatters/NestFormatter.d.ts +0 -19
- package/src/Formatters/RequestFormatter.d.ts +0 -17
- package/src/Formatters/SimpleFormatter.d.ts +0 -21
- package/src/Logger.d.ts +0 -110
- package/src/Logger.js +0 -216
- package/src/Providers/LoggerProvider.d.ts +0 -17
- package/src/Utils/Color.d.ts +0 -48
- package/src/Utils/Color.js +0 -93
- package/src/Utils/getTimestamp.d.ts +0 -9
- package/src/Utils/getTimestamp.js +0 -23
- package/src/Utils/groupConfigs.d.ts +0 -9
- package/src/Utils/groupConfigs.js +0 -18
package/src/Logger.js
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Logger = void 0;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const utils_1 = require("@secjs/utils");
|
|
9
|
-
const Color_1 = require("./Utils/Color");
|
|
10
|
-
const DriverFactory_1 = require("./Factories/DriverFactory");
|
|
11
|
-
const FormatterFactory_1 = require("./Factories/FormatterFactory");
|
|
12
|
-
class Logger {
|
|
13
|
-
/**
|
|
14
|
-
* Creates a new instance of Logger.
|
|
15
|
-
*
|
|
16
|
-
* @return {Logger}
|
|
17
|
-
*/
|
|
18
|
-
constructor() {
|
|
19
|
-
/**
|
|
20
|
-
* Runtime configurations to be used inside the Drivers and Formatters.
|
|
21
|
-
* @private
|
|
22
|
-
*/
|
|
23
|
-
this.runtimeConfig = {};
|
|
24
|
-
/**
|
|
25
|
-
* The log channel selected with driver and formatter configurations.
|
|
26
|
-
* @private
|
|
27
|
-
*/
|
|
28
|
-
this.channelName = 'default';
|
|
29
|
-
this.driver = DriverFactory_1.DriverFactory.fabricate(this.channelName, this.runtimeConfig);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Return all drivers available.
|
|
33
|
-
*/
|
|
34
|
-
static get drivers() {
|
|
35
|
-
return DriverFactory_1.DriverFactory.availableDrivers();
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Return all formatters available.
|
|
39
|
-
*/
|
|
40
|
-
static get formatters() {
|
|
41
|
-
return FormatterFactory_1.FormatterFactory.availableFormatters();
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Builds a new driver to use within Logger class.
|
|
45
|
-
*
|
|
46
|
-
* @param name
|
|
47
|
-
* @param driver
|
|
48
|
-
*/
|
|
49
|
-
static buildDriver(name, driver) {
|
|
50
|
-
DriverFactory_1.DriverFactory.createDriver(name, driver);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Builds a new formatter to use within Logger class.
|
|
54
|
-
*
|
|
55
|
-
* @param name
|
|
56
|
-
* @param formatter
|
|
57
|
-
*/
|
|
58
|
-
static buildFormatter(name, formatter) {
|
|
59
|
-
FormatterFactory_1.FormatterFactory.createFormatter(name, formatter);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Applies the log engine to execute chalk methods of string.
|
|
63
|
-
*
|
|
64
|
-
* @param content
|
|
65
|
-
* @private
|
|
66
|
-
*/
|
|
67
|
-
static applyLogEngine(content) {
|
|
68
|
-
if (utils_1.Is.String(content)) {
|
|
69
|
-
const matches = content.match(/\({(.*?)} (.*?)\)/);
|
|
70
|
-
if (matches) {
|
|
71
|
-
const chalkMethodsString = matches[1].replace(/\s/g, '');
|
|
72
|
-
const chalkMethodsArray = chalkMethodsString.split(',');
|
|
73
|
-
const message = matches[2];
|
|
74
|
-
let chalk = chalk_1.default;
|
|
75
|
-
chalkMethodsArray.forEach(chalkMethod => {
|
|
76
|
-
if (!chalk[chalkMethod])
|
|
77
|
-
return;
|
|
78
|
-
chalk = chalk[chalkMethod];
|
|
79
|
-
});
|
|
80
|
-
content = content
|
|
81
|
-
.replace(`({${matches[1]}} `, '')
|
|
82
|
-
.replace(`({${matches[1]}}`, '')
|
|
83
|
-
.replace(`${matches[2]})`, chalk(message));
|
|
84
|
-
}
|
|
85
|
-
return content;
|
|
86
|
-
}
|
|
87
|
-
return content;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Change the log channel.
|
|
91
|
-
*
|
|
92
|
-
* @param channel
|
|
93
|
-
* @param runtimeConfig
|
|
94
|
-
*/
|
|
95
|
-
channel(channel, runtimeConfig) {
|
|
96
|
-
if (runtimeConfig)
|
|
97
|
-
this.runtimeConfig = runtimeConfig;
|
|
98
|
-
this.driver = DriverFactory_1.DriverFactory.fabricate(channel, this.runtimeConfig);
|
|
99
|
-
this.channelName = channel;
|
|
100
|
-
return this;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Creates a log of type log in channel.
|
|
104
|
-
* @param message
|
|
105
|
-
* @param options
|
|
106
|
-
*/
|
|
107
|
-
log(message, options = {}) {
|
|
108
|
-
options = this.createOptions(options, {});
|
|
109
|
-
message = Logger.applyLogEngine(message);
|
|
110
|
-
return this.driver.transport(message, options);
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Creates a log of type info in channel.
|
|
114
|
-
*
|
|
115
|
-
* @param message
|
|
116
|
-
* @param options
|
|
117
|
-
*/
|
|
118
|
-
info(message, options = {}) {
|
|
119
|
-
options = this.createOptions(options, {
|
|
120
|
-
formatterConfig: {
|
|
121
|
-
level: 'INFO',
|
|
122
|
-
chalk: Color_1.Color.cyan,
|
|
123
|
-
},
|
|
124
|
-
});
|
|
125
|
-
message = Logger.applyLogEngine(message);
|
|
126
|
-
return this.driver.transport(message, options);
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Creates a log of type warn in channel.
|
|
130
|
-
*
|
|
131
|
-
* @param message
|
|
132
|
-
* @param options
|
|
133
|
-
*/
|
|
134
|
-
warn(message, options = {}) {
|
|
135
|
-
options = this.createOptions(options, {
|
|
136
|
-
formatterConfig: {
|
|
137
|
-
level: 'WARN',
|
|
138
|
-
chalk: Color_1.Color.orange,
|
|
139
|
-
},
|
|
140
|
-
});
|
|
141
|
-
message = Logger.applyLogEngine(message);
|
|
142
|
-
return this.driver.transport(message, options);
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Creates a log of type error in channel.
|
|
146
|
-
*
|
|
147
|
-
* @param message
|
|
148
|
-
* @param options
|
|
149
|
-
*/
|
|
150
|
-
error(message, options = {}) {
|
|
151
|
-
options = this.createOptions(options, {
|
|
152
|
-
formatterConfig: {
|
|
153
|
-
level: 'ERROR',
|
|
154
|
-
chalk: Color_1.Color.red,
|
|
155
|
-
},
|
|
156
|
-
});
|
|
157
|
-
message = Logger.applyLogEngine(message);
|
|
158
|
-
return this.driver.transport(message, options);
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Creates a log of type debug in channel.
|
|
162
|
-
*
|
|
163
|
-
* @param message
|
|
164
|
-
* @param options
|
|
165
|
-
*/
|
|
166
|
-
debug(message, options = {}) {
|
|
167
|
-
options = this.createOptions(options, {
|
|
168
|
-
formatterConfig: {
|
|
169
|
-
level: 'DEBUG',
|
|
170
|
-
chalk: Color_1.Color.purple,
|
|
171
|
-
},
|
|
172
|
-
});
|
|
173
|
-
message = Logger.applyLogEngine(message);
|
|
174
|
-
return this.driver.transport(message, options);
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Creates a log of type success in channel.
|
|
178
|
-
*
|
|
179
|
-
* @param message
|
|
180
|
-
* @param options
|
|
181
|
-
*/
|
|
182
|
-
success(message, options = {}) {
|
|
183
|
-
options = this.createOptions(options, {
|
|
184
|
-
formatterConfig: {
|
|
185
|
-
level: 'SUCCESS',
|
|
186
|
-
chalk: Color_1.Color.green,
|
|
187
|
-
},
|
|
188
|
-
});
|
|
189
|
-
message = Logger.applyLogEngine(message);
|
|
190
|
-
return this.driver.transport(message, options);
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Create options concatenating client options with default options.
|
|
194
|
-
*
|
|
195
|
-
* @param options
|
|
196
|
-
* @param defaultValues
|
|
197
|
-
* @private
|
|
198
|
-
*/
|
|
199
|
-
createOptions(options, defaultValues) {
|
|
200
|
-
let formatterConfig = Object.assign({}, {
|
|
201
|
-
...defaultValues.formatterConfig,
|
|
202
|
-
}, options.formatterConfig);
|
|
203
|
-
if (this.runtimeConfig.formatterConfig) {
|
|
204
|
-
formatterConfig = {
|
|
205
|
-
...this.runtimeConfig.formatterConfig,
|
|
206
|
-
...formatterConfig,
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
options = {
|
|
210
|
-
...options,
|
|
211
|
-
formatterConfig,
|
|
212
|
-
};
|
|
213
|
-
return options;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
exports.Logger = Logger;
|
|
@@ -1,17 +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 { 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
|
-
}
|
package/src/Utils/Color.d.ts
DELETED
|
@@ -1,48 +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 chalk, { Chalk } from 'chalk';
|
|
10
|
-
declare type Methods = 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
11
|
-
export declare class Color {
|
|
12
|
-
static chalk: chalk.Chalk & chalk.ChalkFunction & {
|
|
13
|
-
supportsColor: false | chalk.ColorSupport;
|
|
14
|
-
Level: chalk.Level;
|
|
15
|
-
Color: ("black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright") | ("bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray" | "bgGrey" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright");
|
|
16
|
-
ForegroundColor: "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright";
|
|
17
|
-
BackgroundColor: "bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray" | "bgGrey" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright";
|
|
18
|
-
Modifiers: "reset" | "bold" | "dim" | "italic" | "underline" | "inverse" | "hidden" | "strikethrough" | "visible";
|
|
19
|
-
stderr: chalk.Chalk & {
|
|
20
|
-
supportsColor: false | chalk.ColorSupport;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
static get bold(): Chalk;
|
|
24
|
-
static get purple(): Chalk;
|
|
25
|
-
static get darkPurple(): Chalk;
|
|
26
|
-
static get yellow(): Chalk;
|
|
27
|
-
static get cyan(): Chalk;
|
|
28
|
-
static get white(): Chalk;
|
|
29
|
-
static get orange(): Chalk;
|
|
30
|
-
static get green(): Chalk;
|
|
31
|
-
static get darkGreen(): Chalk;
|
|
32
|
-
static get red(): Chalk;
|
|
33
|
-
static get info(): any;
|
|
34
|
-
static get log(): any;
|
|
35
|
-
static get debug(): any;
|
|
36
|
-
static get error(): any;
|
|
37
|
-
static get warning(): any;
|
|
38
|
-
static get GET(): any;
|
|
39
|
-
static get HEAD(): any;
|
|
40
|
-
static get PUT(): any;
|
|
41
|
-
static get PATCH(): any;
|
|
42
|
-
static get POST(): any;
|
|
43
|
-
static get DELETE(): any;
|
|
44
|
-
static get OPTIONS(): any;
|
|
45
|
-
static removeColors(string: string): any;
|
|
46
|
-
static httpMethod(method: Methods): any;
|
|
47
|
-
}
|
|
48
|
-
export {};
|
package/src/Utils/Color.js
DELETED
|
@@ -1,93 +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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
11
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.Color = void 0;
|
|
15
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
16
|
-
class Color {
|
|
17
|
-
static get bold() {
|
|
18
|
-
return Color.chalk.bold;
|
|
19
|
-
}
|
|
20
|
-
static get purple() {
|
|
21
|
-
return Color.chalk.hex('#7628c8');
|
|
22
|
-
}
|
|
23
|
-
static get darkPurple() {
|
|
24
|
-
return Color.chalk.hex('#501b86');
|
|
25
|
-
}
|
|
26
|
-
static get yellow() {
|
|
27
|
-
return Color.chalk.hex('#ffe600');
|
|
28
|
-
}
|
|
29
|
-
static get cyan() {
|
|
30
|
-
return Color.chalk.hex('#00ffff');
|
|
31
|
-
}
|
|
32
|
-
static get white() {
|
|
33
|
-
return Color.chalk.hex('#ffffff');
|
|
34
|
-
}
|
|
35
|
-
static get orange() {
|
|
36
|
-
return Color.chalk.hex('#f18b0e');
|
|
37
|
-
}
|
|
38
|
-
static get green() {
|
|
39
|
-
return Color.chalk.hex('#0ef12c');
|
|
40
|
-
}
|
|
41
|
-
static get darkGreen() {
|
|
42
|
-
return Color.chalk.hex('#1cb70b');
|
|
43
|
-
}
|
|
44
|
-
static get red() {
|
|
45
|
-
return Color.chalk.hex('#f10e0e');
|
|
46
|
-
}
|
|
47
|
-
static get info() {
|
|
48
|
-
return this.cyan.bold;
|
|
49
|
-
}
|
|
50
|
-
static get log() {
|
|
51
|
-
return this.green.bold;
|
|
52
|
-
}
|
|
53
|
-
static get debug() {
|
|
54
|
-
return this.purple.bold;
|
|
55
|
-
}
|
|
56
|
-
static get error() {
|
|
57
|
-
return this.red.bold;
|
|
58
|
-
}
|
|
59
|
-
static get warning() {
|
|
60
|
-
return this.orange.bold;
|
|
61
|
-
}
|
|
62
|
-
static get GET() {
|
|
63
|
-
return this.purple.bold;
|
|
64
|
-
}
|
|
65
|
-
static get HEAD() {
|
|
66
|
-
return this.cyan.bold;
|
|
67
|
-
}
|
|
68
|
-
static get PUT() {
|
|
69
|
-
return this.orange.bold;
|
|
70
|
-
}
|
|
71
|
-
static get PATCH() {
|
|
72
|
-
return this.yellow.bold;
|
|
73
|
-
}
|
|
74
|
-
static get POST() {
|
|
75
|
-
return this.green.bold;
|
|
76
|
-
}
|
|
77
|
-
static get DELETE() {
|
|
78
|
-
return this.red.bold;
|
|
79
|
-
}
|
|
80
|
-
static get OPTIONS() {
|
|
81
|
-
return this.cyan.bold;
|
|
82
|
-
}
|
|
83
|
-
static removeColors(string) {
|
|
84
|
-
return Color.chalk.reset(string).replace(
|
|
85
|
-
// eslint-disable-next-line no-control-regex
|
|
86
|
-
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
|
|
87
|
-
}
|
|
88
|
-
static httpMethod(method) {
|
|
89
|
-
return this[method];
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
exports.Color = Color;
|
|
93
|
-
Color.chalk = chalk_1.default;
|
|
@@ -1,23 +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
|
-
exports.getTimestamp = void 0;
|
|
12
|
-
function getTimestamp() {
|
|
13
|
-
const localeStringOptions = {
|
|
14
|
-
year: 'numeric',
|
|
15
|
-
hour: 'numeric',
|
|
16
|
-
minute: 'numeric',
|
|
17
|
-
second: 'numeric',
|
|
18
|
-
day: '2-digit',
|
|
19
|
-
month: '2-digit',
|
|
20
|
-
};
|
|
21
|
-
return new Date(Date.now()).toLocaleString(undefined, localeStringOptions);
|
|
22
|
-
}
|
|
23
|
-
exports.getTimestamp = getTimestamp;
|
|
@@ -1,9 +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
|
-
export declare function groupConfigs<T = any>(main: any, fallback: any): Required<T>;
|
|
@@ -1,18 +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
|
-
exports.groupConfigs = void 0;
|
|
12
|
-
function groupConfigs(main, fallback) {
|
|
13
|
-
const formatter = main.formatter || fallback.formatter;
|
|
14
|
-
const formatterConfig = Object.assign({}, fallback.formatterConfig, main.formatterConfig);
|
|
15
|
-
const driverConfig = Object.assign({}, fallback, main);
|
|
16
|
-
return { ...driverConfig, formatter, formatterConfig };
|
|
17
|
-
}
|
|
18
|
-
exports.groupConfigs = groupConfigs;
|