@athenna/logger 1.1.6 → 1.1.9
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 +84 -101
- package/src/Drivers/ConsoleDriver.js +43 -22
- package/src/Drivers/DebugDriver.js +45 -23
- package/src/Drivers/DiscordDriver.js +57 -0
- package/src/Drivers/FileDriver.js +51 -34
- package/src/Drivers/NullDriver.js +28 -0
- package/src/Drivers/PinoDriver.js +94 -0
- package/src/Drivers/SlackDriver.js +54 -0
- package/src/Drivers/TelegramDriver.js +53 -0
- 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 +28 -0
- package/src/Facades/Log.js +9 -5
- package/src/Factories/DriverFactory.js +98 -46
- package/src/Factories/FormatterFactory.js +67 -35
- package/src/Formatters/CliFormatter.js +21 -20
- package/src/Formatters/JsonFormatter.js +15 -10
- package/src/Formatters/MessageFormatter.js +40 -0
- 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 -31
- 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/DriverContract.d.ts +0 -11
- 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 -25
- package/src/Drivers/DebugDriver.d.ts +0 -25
- package/src/Drivers/FileDriver.d.ts +0 -23
- 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/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/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 -21
- package/src/Logger.js +0 -140
- 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/Handler.d.ts +0 -13
- package/src/Utils/Handler.js +0 -24
- package/src/Utils/getTimestamp.d.ts +0 -9
- package/src/Utils/getTimestamp.js +0 -23
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;
|
package/src/Utils/Handler.d.ts
DELETED
|
@@ -1,13 +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 class Handler {
|
|
10
|
-
private readonly alias;
|
|
11
|
-
constructor(alias: any);
|
|
12
|
-
get(_object: any, key: string): any;
|
|
13
|
-
}
|
package/src/Utils/Handler.js
DELETED
|
@@ -1,24 +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.Handler = void 0;
|
|
12
|
-
class Handler {
|
|
13
|
-
constructor(alias) {
|
|
14
|
-
this.alias = alias;
|
|
15
|
-
}
|
|
16
|
-
get(_object, key) {
|
|
17
|
-
const provider = ioc.use(this.alias);
|
|
18
|
-
if (!provider) {
|
|
19
|
-
return () => { };
|
|
20
|
-
}
|
|
21
|
-
return provider[key];
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.Handler = Handler;
|
|
@@ -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;
|