@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
|
@@ -1,10 +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 });
|
|
@@ -1,11 +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 interface FormatterContract {
|
|
10
|
-
format(message: any, options?: any): any;
|
|
11
|
-
}
|
|
@@ -1,10 +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 });
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare type LevelTypes = 'info' | 'INFO' | 'debug' | 'DEBUG' | 'warn' | 'WARN' | 'error' | 'ERROR' | 'success' | 'SUCCESS';
|
|
@@ -1,19 +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 { DriverContract } from '../Contracts/DriverContract';
|
|
10
|
-
export interface ConsoleDriverOpts {
|
|
11
|
-
streamType?: 'stdout' | 'stderr';
|
|
12
|
-
formatter?: any;
|
|
13
|
-
formatterConfig?: any;
|
|
14
|
-
}
|
|
15
|
-
export declare class ConsoleDriver implements DriverContract {
|
|
16
|
-
configs: Required<ConsoleDriverOpts>;
|
|
17
|
-
constructor(channel: string, configs?: any);
|
|
18
|
-
transport(message: string, options?: ConsoleDriverOpts): void;
|
|
19
|
-
}
|
|
@@ -1,19 +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 { DriverContract } from '../Contracts/DriverContract';
|
|
10
|
-
export interface DebugDriverOpts {
|
|
11
|
-
namespace?: string;
|
|
12
|
-
formatter?: any;
|
|
13
|
-
formatterConfig?: any;
|
|
14
|
-
}
|
|
15
|
-
export declare class DebugDriver implements DriverContract {
|
|
16
|
-
configs: Required<DebugDriverOpts>;
|
|
17
|
-
constructor(channel: string, configs?: any);
|
|
18
|
-
transport(message: string, options?: DebugDriverOpts): void;
|
|
19
|
-
}
|
|
@@ -1,20 +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 { DriverContract } from '../Contracts/DriverContract';
|
|
10
|
-
export interface DiscordDriverOpts {
|
|
11
|
-
url?: string;
|
|
12
|
-
username?: string;
|
|
13
|
-
formatter?: any;
|
|
14
|
-
formatterConfig?: any;
|
|
15
|
-
}
|
|
16
|
-
export declare class DiscordDriver implements DriverContract {
|
|
17
|
-
configs: Required<DiscordDriverOpts>;
|
|
18
|
-
constructor(channel: string, configs?: any);
|
|
19
|
-
transport(message: string, options?: DiscordDriverOpts): Promise<void>;
|
|
20
|
-
}
|
|
@@ -1,19 +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 { DriverContract } from '../Contracts/DriverContract';
|
|
10
|
-
export interface FileDriverOpts {
|
|
11
|
-
filePath?: string;
|
|
12
|
-
formatter?: any;
|
|
13
|
-
formatterConfig?: any;
|
|
14
|
-
}
|
|
15
|
-
export declare class FileDriver implements DriverContract {
|
|
16
|
-
configs: Required<FileDriverOpts>;
|
|
17
|
-
constructor(channel: string, configs?: any);
|
|
18
|
-
transport(message: string, options?: FileDriverOpts): Promise<void>;
|
|
19
|
-
}
|
|
@@ -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
|
-
import { DriverContract } from '../Contracts/DriverContract';
|
|
10
|
-
export declare class NullDriver implements DriverContract {
|
|
11
|
-
constructor(_channel: string, _configs?: any);
|
|
12
|
-
transport(_message: string, _options?: any): void;
|
|
13
|
-
}
|
|
@@ -1,20 +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 pino from 'pino';
|
|
10
|
-
import pinoPretty from 'pino-pretty';
|
|
11
|
-
import { DriverContract } from '../Contracts/DriverContract';
|
|
12
|
-
export interface PinoDriverOpts extends pino.LoggerOptions {
|
|
13
|
-
formatter: 'pino-pretty';
|
|
14
|
-
formatterConfig: pinoPretty.PrettyOptions;
|
|
15
|
-
}
|
|
16
|
-
export declare class PinoDriver implements DriverContract {
|
|
17
|
-
configs: PinoDriverOpts;
|
|
18
|
-
constructor(channel: string, configs?: any);
|
|
19
|
-
transport(message: any, options?: Partial<PinoDriverOpts>): void;
|
|
20
|
-
}
|
|
@@ -1,19 +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 { DriverContract } from '../Contracts/DriverContract';
|
|
10
|
-
export interface SlackDriverOpts {
|
|
11
|
-
url?: string;
|
|
12
|
-
formatter?: any;
|
|
13
|
-
formatterConfig?: any;
|
|
14
|
-
}
|
|
15
|
-
export declare class SlackDriver implements DriverContract {
|
|
16
|
-
configs: Required<SlackDriverOpts>;
|
|
17
|
-
constructor(channel: string, configs?: any);
|
|
18
|
-
transport(message: string, options?: SlackDriverOpts): Promise<void>;
|
|
19
|
-
}
|
|
@@ -1,21 +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 { DriverContract } from '../Contracts/DriverContract';
|
|
10
|
-
export interface TelegramDriverOpts {
|
|
11
|
-
token?: string;
|
|
12
|
-
chatId?: string | number;
|
|
13
|
-
parseMode?: 'HTML' | 'Markdown' | 'MarkdownV2';
|
|
14
|
-
formatter?: any;
|
|
15
|
-
formatterConfig?: any;
|
|
16
|
-
}
|
|
17
|
-
export declare class TelegramDriver implements DriverContract {
|
|
18
|
-
configs: Required<TelegramDriverOpts>;
|
|
19
|
-
constructor(channel: string, configs?: any);
|
|
20
|
-
transport(message: string, options?: TelegramDriverOpts): Promise<void>;
|
|
21
|
-
}
|
|
@@ -1,12 +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 { Exception } from '@secjs/utils';
|
|
10
|
-
export declare class ChannelNotConfiguredException extends Exception {
|
|
11
|
-
constructor(channelName: string);
|
|
12
|
-
}
|
|
@@ -1,19 +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.ChannelNotConfiguredException = void 0;
|
|
12
|
-
const utils_1 = require("@secjs/utils");
|
|
13
|
-
class ChannelNotConfiguredException extends utils_1.Exception {
|
|
14
|
-
constructor(channelName) {
|
|
15
|
-
const content = `Channel ${channelName} is not configured inside logging.channels object from config/logging file`;
|
|
16
|
-
super(content, 500, 'NOT_CONFIGURED_ERROR', `Implement the channel in the logging.channels`);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.ChannelNotConfiguredException = ChannelNotConfiguredException;
|
|
@@ -1,12 +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 { Exception } from '@secjs/utils';
|
|
10
|
-
export declare class DriverAlreadyExistException extends Exception {
|
|
11
|
-
constructor(driverName: string);
|
|
12
|
-
}
|
|
@@ -1,19 +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.DriverAlreadyExistException = void 0;
|
|
12
|
-
const utils_1 = require("@secjs/utils");
|
|
13
|
-
class DriverAlreadyExistException extends utils_1.Exception {
|
|
14
|
-
constructor(driverName) {
|
|
15
|
-
const content = `The driver ${driverName} already exists`;
|
|
16
|
-
super(content, 500, 'ALREADY_EXIST_ERROR', `The name ${driverName} is already in use. Try using a different name for your driver`);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.DriverAlreadyExistException = DriverAlreadyExistException;
|
|
@@ -1,12 +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 { Exception } from '@secjs/utils';
|
|
10
|
-
export declare class FormatterAlreadyExistException extends Exception {
|
|
11
|
-
constructor(formatterName: string);
|
|
12
|
-
}
|
|
@@ -1,19 +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.FormatterAlreadyExistException = void 0;
|
|
12
|
-
const utils_1 = require("@secjs/utils");
|
|
13
|
-
class FormatterAlreadyExistException extends utils_1.Exception {
|
|
14
|
-
constructor(formatterName) {
|
|
15
|
-
const content = `The formatter ${formatterName} already exists`;
|
|
16
|
-
super(content, 500, 'ALREADY_EXIST_ERROR', `The name ${formatterName} is already in use. Try using a different name for your formatter`);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.FormatterAlreadyExistException = FormatterAlreadyExistException;
|
|
@@ -1,12 +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 { Exception } from '@secjs/utils';
|
|
10
|
-
export declare class NotFoundDriverException extends Exception {
|
|
11
|
-
constructor(driverName: string);
|
|
12
|
-
}
|
|
@@ -1,12 +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 { Exception } from '@secjs/utils';
|
|
10
|
-
export declare class NotFoundFormatterException extends Exception {
|
|
11
|
-
constructor(formatterName: string);
|
|
12
|
-
}
|
|
@@ -1,12 +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 { Exception } from '@secjs/utils';
|
|
10
|
-
export declare class OnlyPinoPrettyException extends Exception {
|
|
11
|
-
constructor();
|
|
12
|
-
}
|
package/src/Facades/Log.d.ts
DELETED
|
@@ -1,10 +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 { Logger } from '../Logger';
|
|
10
|
-
export declare const Log: Logger;
|
|
@@ -1,19 +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 { DriverContract } from '../Contracts/DriverContract';
|
|
10
|
-
export interface DriverObject {
|
|
11
|
-
Driver: any;
|
|
12
|
-
}
|
|
13
|
-
export declare class DriverFactory {
|
|
14
|
-
private static drivers;
|
|
15
|
-
static availableDrivers(): string[];
|
|
16
|
-
static fabricate(channelName: string, runtimeConfig?: any): DriverContract;
|
|
17
|
-
static createDriver(name: string, driver: new (channel: string, configs?: any) => DriverContract): void;
|
|
18
|
-
private static getChannelConfig;
|
|
19
|
-
}
|
|
@@ -1,18 +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 { FormatterContract } from '../Contracts/FormatterContract';
|
|
10
|
-
export interface FormatterObject {
|
|
11
|
-
Formatter: any;
|
|
12
|
-
}
|
|
13
|
-
export declare class FormatterFactory {
|
|
14
|
-
private static formatters;
|
|
15
|
-
static availableFormatters(): string[];
|
|
16
|
-
static fabricate(formatterName: string): FormatterContract;
|
|
17
|
-
static createFormatter(name: string, driver: new () => FormatterContract): void;
|
|
18
|
-
}
|
|
@@ -1,19 +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 } from 'chalk';
|
|
10
|
-
import { LevelTypes } from '../Contracts/LevelTypes';
|
|
11
|
-
import { FormatterContract } from '../Contracts/FormatterContract';
|
|
12
|
-
export interface CliFormatterOptions {
|
|
13
|
-
chalk: Chalk;
|
|
14
|
-
level: LevelTypes;
|
|
15
|
-
}
|
|
16
|
-
export declare class CliFormatter implements FormatterContract {
|
|
17
|
-
private static paintByLevel;
|
|
18
|
-
format(message: string, options: CliFormatterOptions): string;
|
|
19
|
-
}
|
|
@@ -1,16 +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 } from 'chalk';
|
|
10
|
-
import { FormatterContract } from '../Contracts/FormatterContract';
|
|
11
|
-
export interface JsonFormatterOptions {
|
|
12
|
-
chalk: Chalk;
|
|
13
|
-
}
|
|
14
|
-
export declare class JsonFormatter implements FormatterContract {
|
|
15
|
-
format(message: Record<any, unknown>, options: JsonFormatterOptions): string;
|
|
16
|
-
}
|
|
@@ -1,20 +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 { LevelTypes } from '../Contracts/LevelTypes';
|
|
10
|
-
import { FormatterContract } from '../Contracts/FormatterContract';
|
|
11
|
-
export interface MessageFormatterOpts {
|
|
12
|
-
level: LevelTypes;
|
|
13
|
-
customEmoji: string;
|
|
14
|
-
}
|
|
15
|
-
export declare class MessageFormatter implements FormatterContract {
|
|
16
|
-
private static lastTimestamp?;
|
|
17
|
-
private static getTimestampDiff;
|
|
18
|
-
private static getEmojiByLevel;
|
|
19
|
-
format(message: string, options: MessageFormatterOpts): string;
|
|
20
|
-
}
|
|
@@ -1,19 +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 } from 'chalk';
|
|
10
|
-
import { FormatterContract } from '../Contracts/FormatterContract';
|
|
11
|
-
export interface ContextFormatterOptions {
|
|
12
|
-
chalk: Chalk;
|
|
13
|
-
context: string;
|
|
14
|
-
}
|
|
15
|
-
export declare class NestFormatter implements FormatterContract {
|
|
16
|
-
private static lastTimestamp?;
|
|
17
|
-
private static getTimestampDiff;
|
|
18
|
-
format(message: string, options: ContextFormatterOptions): string;
|
|
19
|
-
}
|
|
@@ -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 { Chalk } from 'chalk';
|
|
10
|
-
import { FormatterContract } from '../Contracts/FormatterContract';
|
|
11
|
-
export interface RequestFormatterOptions {
|
|
12
|
-
chalk: Chalk;
|
|
13
|
-
asJson: boolean;
|
|
14
|
-
}
|
|
15
|
-
export declare class RequestFormatter implements FormatterContract {
|
|
16
|
-
format(ctx: any, options: RequestFormatterOptions): string;
|
|
17
|
-
}
|
|
@@ -1,21 +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 } from 'chalk';
|
|
10
|
-
import { LevelTypes } from '../Contracts/LevelTypes';
|
|
11
|
-
import { FormatterContract } from '../Contracts/FormatterContract';
|
|
12
|
-
export interface SimpleFormatterOpts {
|
|
13
|
-
chalk: Chalk;
|
|
14
|
-
level: LevelTypes;
|
|
15
|
-
}
|
|
16
|
-
export declare class SimpleFormatter implements FormatterContract {
|
|
17
|
-
private static lastTimestamp?;
|
|
18
|
-
private static getTimestampDiff;
|
|
19
|
-
private static paintByLevel;
|
|
20
|
-
format(message: string, options: SimpleFormatterOpts): string;
|
|
21
|
-
}
|
package/src/Logger.d.ts
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { DriverContract } from './Contracts/DriverContract';
|
|
2
|
-
import { FormatterContract } from './Contracts/FormatterContract';
|
|
3
|
-
export declare class Logger {
|
|
4
|
-
/**
|
|
5
|
-
* Runtime configurations to be used inside the Drivers and Formatters.
|
|
6
|
-
* @private
|
|
7
|
-
*/
|
|
8
|
-
private runtimeConfig;
|
|
9
|
-
/**
|
|
10
|
-
* The driver responsible for transporting the logs.
|
|
11
|
-
* @private
|
|
12
|
-
*/
|
|
13
|
-
private driver;
|
|
14
|
-
/**
|
|
15
|
-
* The log channel selected with driver and formatter configurations.
|
|
16
|
-
* @private
|
|
17
|
-
*/
|
|
18
|
-
private channelName;
|
|
19
|
-
/**
|
|
20
|
-
* Creates a new instance of Logger.
|
|
21
|
-
*
|
|
22
|
-
* @return {Logger}
|
|
23
|
-
*/
|
|
24
|
-
constructor();
|
|
25
|
-
/**
|
|
26
|
-
* Return all drivers available.
|
|
27
|
-
*/
|
|
28
|
-
static get drivers(): string[];
|
|
29
|
-
/**
|
|
30
|
-
* Return all formatters available.
|
|
31
|
-
*/
|
|
32
|
-
static get formatters(): string[];
|
|
33
|
-
/**
|
|
34
|
-
* Builds a new driver to use within Logger class.
|
|
35
|
-
*
|
|
36
|
-
* @param name
|
|
37
|
-
* @param driver
|
|
38
|
-
*/
|
|
39
|
-
static buildDriver(name: string, driver: new (channel: string, configs?: any) => DriverContract): void;
|
|
40
|
-
/**
|
|
41
|
-
* Builds a new formatter to use within Logger class.
|
|
42
|
-
*
|
|
43
|
-
* @param name
|
|
44
|
-
* @param formatter
|
|
45
|
-
*/
|
|
46
|
-
static buildFormatter(name: string, formatter: new () => FormatterContract): void;
|
|
47
|
-
/**
|
|
48
|
-
* Applies the log engine to execute chalk methods of string.
|
|
49
|
-
*
|
|
50
|
-
* @param content
|
|
51
|
-
* @private
|
|
52
|
-
*/
|
|
53
|
-
private static applyLogEngine;
|
|
54
|
-
/**
|
|
55
|
-
* Change the log channel.
|
|
56
|
-
*
|
|
57
|
-
* @param channel
|
|
58
|
-
* @param runtimeConfig
|
|
59
|
-
*/
|
|
60
|
-
channel(channel: string, runtimeConfig?: any): Logger;
|
|
61
|
-
/**
|
|
62
|
-
* Creates a log of type log in channel.
|
|
63
|
-
* @param message
|
|
64
|
-
* @param options
|
|
65
|
-
*/
|
|
66
|
-
log(message: any, options?: {}): void | Promise<void>;
|
|
67
|
-
/**
|
|
68
|
-
* Creates a log of type info in channel.
|
|
69
|
-
*
|
|
70
|
-
* @param message
|
|
71
|
-
* @param options
|
|
72
|
-
*/
|
|
73
|
-
info(message: any, options?: {}): void | Promise<void>;
|
|
74
|
-
/**
|
|
75
|
-
* Creates a log of type warn in channel.
|
|
76
|
-
*
|
|
77
|
-
* @param message
|
|
78
|
-
* @param options
|
|
79
|
-
*/
|
|
80
|
-
warn(message: any, options?: {}): void | Promise<void>;
|
|
81
|
-
/**
|
|
82
|
-
* Creates a log of type error in channel.
|
|
83
|
-
*
|
|
84
|
-
* @param message
|
|
85
|
-
* @param options
|
|
86
|
-
*/
|
|
87
|
-
error(message: any, options?: {}): void | Promise<void>;
|
|
88
|
-
/**
|
|
89
|
-
* Creates a log of type debug in channel.
|
|
90
|
-
*
|
|
91
|
-
* @param message
|
|
92
|
-
* @param options
|
|
93
|
-
*/
|
|
94
|
-
debug(message: any, options?: {}): void | Promise<void>;
|
|
95
|
-
/**
|
|
96
|
-
* Creates a log of type success in channel.
|
|
97
|
-
*
|
|
98
|
-
* @param message
|
|
99
|
-
* @param options
|
|
100
|
-
*/
|
|
101
|
-
success(message: any, options?: {}): void | Promise<void>;
|
|
102
|
-
/**
|
|
103
|
-
* Create options concatenating client options with default options.
|
|
104
|
-
*
|
|
105
|
-
* @param options
|
|
106
|
-
* @param defaultValues
|
|
107
|
-
* @private
|
|
108
|
-
*/
|
|
109
|
-
private createOptions;
|
|
110
|
-
}
|