@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.
Files changed (68) hide show
  1. package/LICENSE.md +3 -15
  2. package/README.md +6 -6
  3. package/package.json +84 -101
  4. package/src/Drivers/ConsoleDriver.js +43 -22
  5. package/src/Drivers/DebugDriver.js +45 -23
  6. package/src/Drivers/DiscordDriver.js +57 -0
  7. package/src/Drivers/FileDriver.js +51 -34
  8. package/src/Drivers/NullDriver.js +28 -0
  9. package/src/Drivers/PinoDriver.js +94 -0
  10. package/src/Drivers/SlackDriver.js +54 -0
  11. package/src/Drivers/TelegramDriver.js +53 -0
  12. package/src/Exceptions/DriverExistException.js +31 -0
  13. package/src/Exceptions/FormatterExistException.js +32 -0
  14. package/src/Exceptions/NotFoundChannelException.js +32 -0
  15. package/src/Exceptions/NotFoundDriverException.js +22 -10
  16. package/src/Exceptions/NotFoundFormatterException.js +22 -10
  17. package/src/Exceptions/OnlyPinoPrettyException.js +28 -0
  18. package/src/Facades/Log.js +9 -5
  19. package/src/Factories/DriverFactory.js +98 -46
  20. package/src/Factories/FormatterFactory.js +67 -35
  21. package/src/Formatters/CliFormatter.js +21 -20
  22. package/src/Formatters/JsonFormatter.js +15 -10
  23. package/src/Formatters/MessageFormatter.js +40 -0
  24. package/src/Formatters/NestFormatter.js +31 -22
  25. package/src/Formatters/NoneFormatter.js +21 -0
  26. package/src/Formatters/RequestFormatter.js +49 -37
  27. package/src/Formatters/SimpleFormatter.js +30 -31
  28. package/src/Helpers/ColorHelper.js +259 -0
  29. package/src/Helpers/FactoryHelper.js +121 -0
  30. package/src/Providers/LoggerProvider.js +13 -15
  31. package/src/index.d.ts +383 -0
  32. package/src/index.js +269 -0
  33. package/index.d.ts +0 -13
  34. package/index.js +0 -25
  35. package/src/Contracts/DriverContract.d.ts +0 -11
  36. package/src/Contracts/DriverContract.js +0 -10
  37. package/src/Contracts/FormatterContract.d.ts +0 -11
  38. package/src/Contracts/FormatterContract.js +0 -10
  39. package/src/Contracts/LevelTypes.d.ts +0 -1
  40. package/src/Contracts/LevelTypes.js +0 -2
  41. package/src/Drivers/ConsoleDriver.d.ts +0 -25
  42. package/src/Drivers/DebugDriver.d.ts +0 -25
  43. package/src/Drivers/FileDriver.d.ts +0 -23
  44. package/src/Exceptions/ChannelNotConfiguredException.d.ts +0 -12
  45. package/src/Exceptions/ChannelNotConfiguredException.js +0 -19
  46. package/src/Exceptions/DriverAlreadyExistException.d.ts +0 -12
  47. package/src/Exceptions/DriverAlreadyExistException.js +0 -19
  48. package/src/Exceptions/FormatterAlreadyExistException.d.ts +0 -12
  49. package/src/Exceptions/FormatterAlreadyExistException.js +0 -19
  50. package/src/Exceptions/NotFoundDriverException.d.ts +0 -12
  51. package/src/Exceptions/NotFoundFormatterException.d.ts +0 -12
  52. package/src/Facades/Log.d.ts +0 -10
  53. package/src/Factories/DriverFactory.d.ts +0 -19
  54. package/src/Factories/FormatterFactory.d.ts +0 -18
  55. package/src/Formatters/CliFormatter.d.ts +0 -19
  56. package/src/Formatters/JsonFormatter.d.ts +0 -16
  57. package/src/Formatters/NestFormatter.d.ts +0 -19
  58. package/src/Formatters/RequestFormatter.d.ts +0 -17
  59. package/src/Formatters/SimpleFormatter.d.ts +0 -21
  60. package/src/Logger.d.ts +0 -21
  61. package/src/Logger.js +0 -140
  62. package/src/Providers/LoggerProvider.d.ts +0 -17
  63. package/src/Utils/Color.d.ts +0 -48
  64. package/src/Utils/Color.js +0 -93
  65. package/src/Utils/Handler.d.ts +0 -13
  66. package/src/Utils/Handler.js +0 -24
  67. package/src/Utils/getTimestamp.d.ts +0 -9
  68. package/src/Utils/getTimestamp.js +0 -23
@@ -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,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,25 +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 { Color } from '../Utils/Color';
10
- import { DriverContract } from '../Contracts/DriverContract';
11
- export interface ConsoleDriverOpts {
12
- color: Color;
13
- level: string;
14
- context: string;
15
- formatter: string;
16
- streamType: string;
17
- formatterConfig: any;
18
- }
19
- export declare class ConsoleDriver implements DriverContract {
20
- private readonly _formatter;
21
- private readonly _streamType;
22
- private readonly _formatterConfig;
23
- constructor(channel: string, configs?: any);
24
- transport(message: string, options?: ConsoleDriverOpts): void;
25
- }
@@ -1,25 +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 { Color } from '../Utils/Color';
10
- import { DriverContract } from '../Contracts/DriverContract';
11
- export interface DebugDriverOpts {
12
- color: Color;
13
- level: string;
14
- context: string;
15
- formatter: string;
16
- namespace: string;
17
- formatterConfig: any;
18
- }
19
- export declare class DebugDriver implements DriverContract {
20
- private readonly _formatter;
21
- private readonly _namespace;
22
- private readonly _formatterConfig;
23
- constructor(channel: string, configs?: any);
24
- transport(message: string, options?: DebugDriverOpts): void;
25
- }
@@ -1,23 +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
- level: string;
12
- context: string;
13
- formatter: string;
14
- filePath: string;
15
- formatterConfig: any;
16
- }
17
- export declare class FileDriver implements DriverContract {
18
- private readonly _filePath;
19
- private readonly _formatter;
20
- private readonly _formatterConfig;
21
- constructor(channel: string, configs?: any);
22
- transport(message: string, options?: FileDriverOpts): Promise<void>;
23
- }
@@ -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,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,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 LogFormatterOptions {
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: LogFormatterOptions): string;
21
- }
package/src/Logger.d.ts DELETED
@@ -1,21 +0,0 @@
1
- import { DriverContract } from './Contracts/DriverContract';
2
- import { FormatterContract } from './Contracts/FormatterContract';
3
- export declare class Logger {
4
- private runtimeConfig;
5
- private channelName;
6
- private driver;
7
- constructor(runtimeConfig?: any);
8
- static get drivers(): string[];
9
- static get formatters(): string[];
10
- static buildDriver(name: string, driver: new (channel: string, configs?: any) => DriverContract): void;
11
- static buildFormatter(name: string, formatter: new () => FormatterContract): void;
12
- private static applyLogEngine;
13
- channel(channel: string, runtimeConfig?: any): Logger;
14
- log(message: any, options?: {}): void | Promise<void>;
15
- info(message: any, options?: {}): void | Promise<void>;
16
- warn(message: any, options?: {}): void | Promise<void>;
17
- error(message: any, options?: {}): void | Promise<void>;
18
- debug(message: any, options?: {}): void | Promise<void>;
19
- success(message: any, options?: {}): void | Promise<void>;
20
- private createOptions;
21
- }
package/src/Logger.js DELETED
@@ -1,140 +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
- constructor(runtimeConfig = {}) {
14
- this.runtimeConfig = runtimeConfig;
15
- this.channelName = 'default';
16
- this.driver = DriverFactory_1.DriverFactory.fabricate(this.channelName, this.runtimeConfig);
17
- }
18
- static get drivers() {
19
- return DriverFactory_1.DriverFactory.availableDrivers();
20
- }
21
- static get formatters() {
22
- return FormatterFactory_1.FormatterFactory.availableFormatters();
23
- }
24
- static buildDriver(name, driver) {
25
- DriverFactory_1.DriverFactory.createDriver(name, driver);
26
- }
27
- static buildFormatter(name, formatter) {
28
- FormatterFactory_1.FormatterFactory.createFormatter(name, formatter);
29
- }
30
- static applyLogEngine(content) {
31
- if (utils_1.Is.String(content)) {
32
- const matches = content.match(/\({(.*?)} (.*?)\)/);
33
- if (matches) {
34
- const chalkMethodsString = matches[1].replace(/\s/g, '');
35
- const chalkMethodsArray = chalkMethodsString.split(',');
36
- const message = matches[2];
37
- let chalk = chalk_1.default;
38
- chalkMethodsArray.forEach(chalkMethod => {
39
- if (!chalk[chalkMethod])
40
- return;
41
- chalk = chalk[chalkMethod];
42
- });
43
- content = content
44
- .replace(`({${matches[1]}} `, '')
45
- .replace(`({${matches[1]}}`, '')
46
- .replace(`${matches[2]})`, chalk(message));
47
- }
48
- return content;
49
- }
50
- return content;
51
- }
52
- channel(channel, runtimeConfig) {
53
- if (runtimeConfig)
54
- this.runtimeConfig = runtimeConfig;
55
- this.driver = DriverFactory_1.DriverFactory.fabricate(channel, this.runtimeConfig);
56
- return this;
57
- }
58
- log(message, options = {}) {
59
- options = this.createOptions(options, {
60
- streamType: 'stdout',
61
- });
62
- message = Logger.applyLogEngine(message);
63
- return this.driver.transport(message, options);
64
- }
65
- info(message, options = {}) {
66
- options = this.createOptions(options, {
67
- streamType: 'stdout',
68
- formatterConfig: {
69
- level: 'INFO',
70
- chalk: Color_1.Color.cyan,
71
- },
72
- });
73
- message = Logger.applyLogEngine(message);
74
- return this.driver.transport(message, options);
75
- }
76
- warn(message, options = {}) {
77
- options = this.createOptions(options, {
78
- streamType: 'stdout',
79
- formatterConfig: {
80
- level: 'WARN',
81
- chalk: Color_1.Color.orange,
82
- },
83
- });
84
- message = Logger.applyLogEngine(message);
85
- return this.driver.transport(message, options);
86
- }
87
- error(message, options = {}) {
88
- options = this.createOptions(options, {
89
- streamType: 'stdout',
90
- formatterConfig: {
91
- level: 'ERROR',
92
- chalk: Color_1.Color.red,
93
- },
94
- });
95
- message = Logger.applyLogEngine(message);
96
- return this.driver.transport(message, options);
97
- }
98
- debug(message, options = {}) {
99
- options = this.createOptions(options, {
100
- streamType: 'stdout',
101
- formatterConfig: {
102
- level: 'DEBUG',
103
- chalk: Color_1.Color.purple,
104
- },
105
- });
106
- message = Logger.applyLogEngine(message);
107
- return this.driver.transport(message, options);
108
- }
109
- success(message, options = {}) {
110
- options = this.createOptions(options, {
111
- streamType: 'stdout',
112
- formatterConfig: {
113
- level: 'SUCCESS',
114
- chalk: Color_1.Color.green,
115
- },
116
- });
117
- message = Logger.applyLogEngine(message);
118
- return this.driver.transport(message, options);
119
- }
120
- createOptions(options, defaultValues) {
121
- let formatterConfig = Object.assign({}, {
122
- ...defaultValues.formatterConfig,
123
- }, options.formatterConfig);
124
- if (this.runtimeConfig.formatterConfig) {
125
- formatterConfig = {
126
- ...this.runtimeConfig.formatterConfig,
127
- ...formatterConfig,
128
- };
129
- }
130
- options = Object.assign({}, {
131
- streamType: 'stdout',
132
- }, options);
133
- options = {
134
- ...options,
135
- formatterConfig,
136
- };
137
- return options;
138
- }
139
- }
140
- 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
- }
@@ -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 {};