@athenna/logger 3.0.9 → 3.1.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.
Files changed (83) hide show
  1. package/build/Drivers/ConsoleDriver.d.ts +12 -0
  2. package/build/Drivers/ConsoleDriver.js +19 -0
  3. package/build/Drivers/DiscordDriver.d.ts +12 -0
  4. package/build/Drivers/DiscordDriver.js +22 -0
  5. package/build/Drivers/Driver.d.ts +52 -0
  6. package/build/Drivers/Driver.js +85 -0
  7. package/build/Drivers/FileDriver.d.ts +12 -0
  8. package/build/Drivers/FileDriver.js +24 -0
  9. package/build/Drivers/NullDriver.d.ts +12 -0
  10. package/build/Drivers/NullDriver.js +14 -0
  11. package/build/Drivers/SlackDriver.d.ts +12 -0
  12. package/build/Drivers/SlackDriver.js +19 -0
  13. package/build/Drivers/StackDriver.d.ts +12 -0
  14. package/build/Drivers/StackDriver.js +19 -0
  15. package/build/Drivers/TelegramDriver.d.ts +12 -0
  16. package/build/Drivers/TelegramDriver.js +21 -0
  17. package/build/Exceptions/DriverExistException.d.ts +12 -0
  18. package/build/Exceptions/DriverExistException.js +21 -0
  19. package/{src/Facades/Log.js → build/Exceptions/FormatterExistException.d.ts} +4 -9
  20. package/build/Exceptions/FormatterExistException.js +21 -0
  21. package/build/Exceptions/NotFoundDriverException.d.ts +12 -0
  22. package/build/Exceptions/NotFoundDriverException.js +21 -0
  23. package/build/Exceptions/NotFoundFormatterException.d.ts +12 -0
  24. package/build/Exceptions/NotFoundFormatterException.js +21 -0
  25. package/build/Exceptions/NotImplementedConfigException.d.ts +12 -0
  26. package/build/Exceptions/NotImplementedConfigException.js +28 -0
  27. package/build/Facades/Log.d.ts +10 -0
  28. package/build/Facades/Log.js +10 -0
  29. package/build/Factories/DriverFactory.d.ts +39 -0
  30. package/build/Factories/DriverFactory.js +93 -0
  31. package/build/Factories/FormatterFactory.d.ts +29 -0
  32. package/build/Factories/FormatterFactory.js +57 -0
  33. package/build/Formatters/CliFormatter.d.ts +12 -0
  34. package/build/Formatters/CliFormatter.js +15 -0
  35. package/build/Formatters/Formatter.d.ts +85 -0
  36. package/build/Formatters/Formatter.js +176 -0
  37. package/build/Formatters/JsonFormatter.d.ts +12 -0
  38. package/build/Formatters/JsonFormatter.js +26 -0
  39. package/build/Formatters/MessageFormatter.d.ts +12 -0
  40. package/build/Formatters/MessageFormatter.js +14 -0
  41. package/build/Formatters/NoneFormatter.d.ts +12 -0
  42. package/{src → build}/Formatters/NoneFormatter.js +4 -12
  43. package/build/Formatters/RequestFormatter.d.ts +12 -0
  44. package/build/Formatters/RequestFormatter.js +48 -0
  45. package/build/Formatters/SimpleFormatter.d.ts +12 -0
  46. package/build/Formatters/SimpleFormatter.js +18 -0
  47. package/build/Helpers/FactoryHelper.d.ts +14 -0
  48. package/build/Helpers/FactoryHelper.js +20 -0
  49. package/build/Logger/Logger.d.ts +68 -0
  50. package/build/Logger/Logger.js +105 -0
  51. package/build/Logger/VanillaLogger.d.ts +65 -0
  52. package/build/Logger/VanillaLogger.js +93 -0
  53. package/build/Providers/LoggerProvider.d.ts +12 -0
  54. package/{src → build}/Providers/LoggerProvider.js +5 -12
  55. package/build/index.d.ts +17 -0
  56. package/build/index.js +17 -0
  57. package/package.json +82 -61
  58. package/src/Drivers/ConsoleDriver.js +0 -40
  59. package/src/Drivers/DiscordDriver.js +0 -43
  60. package/src/Drivers/Driver.js +0 -134
  61. package/src/Drivers/FileDriver.js +0 -47
  62. package/src/Drivers/NullDriver.js +0 -33
  63. package/src/Drivers/SlackDriver.js +0 -40
  64. package/src/Drivers/StackDriver.js +0 -45
  65. package/src/Drivers/TelegramDriver.js +0 -46
  66. package/src/Exceptions/DriverExistException.js +0 -31
  67. package/src/Exceptions/FormatterExistException.js +0 -32
  68. package/src/Exceptions/NotFoundDriverException.js +0 -31
  69. package/src/Exceptions/NotFoundFormatterException.js +0 -31
  70. package/src/Exceptions/NotImplementedConfigException.js +0 -37
  71. package/src/Factories/DriverFactory.js +0 -128
  72. package/src/Factories/FormatterFactory.js +0 -77
  73. package/src/Formatters/CliFormatter.js +0 -24
  74. package/src/Formatters/Formatter.js +0 -266
  75. package/src/Formatters/JsonFormatter.js +0 -37
  76. package/src/Formatters/MessageFormatter.js +0 -26
  77. package/src/Formatters/RequestFormatter.js +0 -64
  78. package/src/Formatters/SimpleFormatter.js +0 -27
  79. package/src/Helpers/ColorHelper.js +0 -322
  80. package/src/Helpers/FactoryHelper.js +0 -31
  81. package/src/Helpers/VanillaLogger.js +0 -134
  82. package/src/index.d.ts +0 -797
  83. package/src/index.js +0 -180
@@ -0,0 +1,20 @@
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 { Options } from '@athenna/common';
10
+ export class FactoryHelper {
11
+ /**
12
+ * Group the configuration values.
13
+ */
14
+ static groupConfigs(object, defaultValue) {
15
+ const formatter = object.formatter || defaultValue.formatter;
16
+ const formatterConfig = Options.create(object.formatterConfig, defaultValue.formatterConfig);
17
+ const driverConfig = Options.create(object, defaultValue);
18
+ return { ...driverConfig, formatter, formatterConfig };
19
+ }
20
+ }
@@ -0,0 +1,68 @@
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 { VanillaLogger } from '#src/Logger/VanillaLogger';
10
+ export declare class Logger {
11
+ /**
12
+ * The drivers responsible for transporting the logs.
13
+ */
14
+ private drivers;
15
+ /**
16
+ * Runtime configurations to be used inside the Drivers and Formatters.
17
+ */
18
+ private runtimeConfigs;
19
+ constructor();
20
+ /**
21
+ * Set runtime configurations for drivers and
22
+ * formatters.
23
+ */
24
+ config(runtimeConfigs: any): this;
25
+ /**
26
+ * Change the log channel.
27
+ */
28
+ channel(...channels: string[]): this;
29
+ /**
30
+ * Call drivers to transport the log.
31
+ */
32
+ private log;
33
+ /**
34
+ * Creates a log of type trace in channel.
35
+ */
36
+ trace(...args: any[]): any | Promise<any>;
37
+ /**
38
+ * Creates a log of type debug in channel.
39
+ */
40
+ debug(...args: any[]): any | Promise<any>;
41
+ /**
42
+ * Creates a log of type info in channel.
43
+ */
44
+ info(...args: any[]): any | Promise<any>;
45
+ /**
46
+ * Creates a log of type success in channel.
47
+ */
48
+ success(...args: any[]): any | Promise<any>;
49
+ /**
50
+ * Creates a log of type warn in channel.
51
+ */
52
+ warn(...args: any[]): any | Promise<any>;
53
+ /**
54
+ * Creates a log of type error in channel.
55
+ */
56
+ error(...args: any[]): any | Promise<any>;
57
+ /**
58
+ * Creates a log of type fatal in channel.
59
+ */
60
+ fatal(...args: any[]): any | Promise<any>;
61
+ /**
62
+ * Get a new instance of any log driver
63
+ * with vanilla configurations. By default,
64
+ * vanilla logger will use the "console" driver
65
+ * and "none" formatter.
66
+ */
67
+ static getVanillaLogger(configs?: any): VanillaLogger;
68
+ }
@@ -0,0 +1,105 @@
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 '@athenna/common';
10
+ import { Config } from '@athenna/config';
11
+ import { VanillaLogger } from '#src/Logger/VanillaLogger';
12
+ import { DriverFactory } from '#src/Factories/DriverFactory';
13
+ export class Logger {
14
+ /**
15
+ * The drivers responsible for transporting the logs.
16
+ */
17
+ drivers = [];
18
+ /**
19
+ * Runtime configurations to be used inside the Drivers and Formatters.
20
+ */
21
+ runtimeConfigs = {};
22
+ constructor() {
23
+ if (!Config.exists(`logging.channels.${Config.get('logging.default')}`)) {
24
+ return this;
25
+ }
26
+ this.drivers.push(DriverFactory.fabricate('default', this.runtimeConfigs));
27
+ }
28
+ /**
29
+ * Set runtime configurations for drivers and
30
+ * formatters.
31
+ */
32
+ config(runtimeConfigs) {
33
+ this.runtimeConfigs = runtimeConfigs;
34
+ return this;
35
+ }
36
+ /**
37
+ * Change the log channel.
38
+ */
39
+ channel(...channels) {
40
+ this.drivers = [];
41
+ channels.forEach(c => {
42
+ this.drivers.push(DriverFactory.fabricate(c, this.runtimeConfigs));
43
+ });
44
+ return this;
45
+ }
46
+ /**
47
+ * Call drivers to transport the log.
48
+ */
49
+ async log(level, ...args) {
50
+ const message = Color.apply(...args);
51
+ const promises = this.drivers.map((driver) => driver.transport(level, message));
52
+ return Promise.all(promises);
53
+ }
54
+ /**
55
+ * Creates a log of type trace in channel.
56
+ */
57
+ trace(...args) {
58
+ return this.log('trace', ...args);
59
+ }
60
+ /**
61
+ * Creates a log of type debug in channel.
62
+ */
63
+ debug(...args) {
64
+ return this.log('debug', ...args);
65
+ }
66
+ /**
67
+ * Creates a log of type info in channel.
68
+ */
69
+ info(...args) {
70
+ return this.log('info', ...args);
71
+ }
72
+ /**
73
+ * Creates a log of type success in channel.
74
+ */
75
+ success(...args) {
76
+ return this.log('success', ...args);
77
+ }
78
+ /**
79
+ * Creates a log of type warn in channel.
80
+ */
81
+ warn(...args) {
82
+ return this.log('warn', ...args);
83
+ }
84
+ /**
85
+ * Creates a log of type error in channel.
86
+ */
87
+ error(...args) {
88
+ return this.log('error', ...args);
89
+ }
90
+ /**
91
+ * Creates a log of type fatal in channel.
92
+ */
93
+ fatal(...args) {
94
+ return this.log('fatal', ...args);
95
+ }
96
+ /**
97
+ * Get a new instance of any log driver
98
+ * with vanilla configurations. By default,
99
+ * vanilla logger will use the "console" driver
100
+ * and "none" formatter.
101
+ */
102
+ static getVanillaLogger(configs = {}) {
103
+ return new VanillaLogger(configs);
104
+ }
105
+ }
@@ -0,0 +1,65 @@
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 VanillaLogger {
10
+ /**
11
+ * The driver responsible for transporting the logs.
12
+ */
13
+ drivers: any[];
14
+ constructor(configs: any);
15
+ /**
16
+ * Log a simple log message without using the log driver
17
+ * but using the Color engine.
18
+ */
19
+ simple(...args: any[]): void;
20
+ /**
21
+ * Set runtime configurations for drivers and
22
+ * formatters.
23
+ */
24
+ config(): VanillaLogger;
25
+ /**
26
+ * Change the log channel.
27
+ */
28
+ channel(): VanillaLogger;
29
+ /**
30
+ * Call drivers to transport the log.
31
+ *
32
+ * @param {string} level
33
+ * @param {string} args
34
+ * @return {any | Promise<any>}
35
+ */
36
+ private log;
37
+ /**
38
+ * Creates a log of type trace in channel.
39
+ */
40
+ trace(...args: any[]): any | Promise<any>;
41
+ /**
42
+ * Creates a log of type debug in channel.
43
+ */
44
+ debug(...args: any[]): any | Promise<any>;
45
+ /**
46
+ * Creates a log of type info in channel.
47
+ */
48
+ info(...args: any[]): any | Promise<any>;
49
+ /**
50
+ * Creates a log of type success in channel.
51
+ */
52
+ success(...args: any[]): any | Promise<any>;
53
+ /**
54
+ * Creates a log of type warn in channel.
55
+ */
56
+ warn(...args: any[]): any | Promise<any>;
57
+ /**
58
+ * Creates a log of type error in channel.
59
+ */
60
+ error(...args: any[]): any | Promise<any>;
61
+ /**
62
+ * Creates a log of type fatal in channel.
63
+ */
64
+ fatal(...args: any[]): any | Promise<any>;
65
+ }
@@ -0,0 +1,93 @@
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 '@athenna/common';
10
+ import { DriverFactory } from '#src/Factories/DriverFactory';
11
+ export class VanillaLogger {
12
+ /**
13
+ * The driver responsible for transporting the logs.
14
+ */
15
+ drivers = [];
16
+ constructor(configs) {
17
+ this.drivers.push(DriverFactory.fabricateVanilla(configs));
18
+ }
19
+ /**
20
+ * Log a simple log message without using the log driver
21
+ * but using the Color engine.
22
+ */
23
+ simple(...args) {
24
+ process.stdout.write(Color.apply(...args).concat('\n'));
25
+ }
26
+ /**
27
+ * Set runtime configurations for drivers and
28
+ * formatters.
29
+ */
30
+ config() {
31
+ return this;
32
+ }
33
+ /**
34
+ * Change the log channel.
35
+ */
36
+ channel() {
37
+ return this;
38
+ }
39
+ /**
40
+ * Call drivers to transport the log.
41
+ *
42
+ * @param {string} level
43
+ * @param {string} args
44
+ * @return {any | Promise<any>}
45
+ */
46
+ log(level, ...args) {
47
+ const message = Color.apply(...args);
48
+ const promises = this.drivers.map((driver) => driver.transport(level, message));
49
+ return Promise.all(promises);
50
+ }
51
+ /**
52
+ * Creates a log of type trace in channel.
53
+ */
54
+ trace(...args) {
55
+ return this.log('trace', ...args);
56
+ }
57
+ /**
58
+ * Creates a log of type debug in channel.
59
+ */
60
+ debug(...args) {
61
+ return this.log('debug', ...args);
62
+ }
63
+ /**
64
+ * Creates a log of type info in channel.
65
+ */
66
+ info(...args) {
67
+ return this.log('info', ...args);
68
+ }
69
+ /**
70
+ * Creates a log of type success in channel.
71
+ */
72
+ success(...args) {
73
+ return this.log('success', ...args);
74
+ }
75
+ /**
76
+ * Creates a log of type warn in channel.
77
+ */
78
+ warn(...args) {
79
+ return this.log('warn', ...args);
80
+ }
81
+ /**
82
+ * Creates a log of type error in channel.
83
+ */
84
+ error(...args) {
85
+ return this.log('error', ...args);
86
+ }
87
+ /**
88
+ * Creates a log of type fatal in channel.
89
+ */
90
+ fatal(...args) {
91
+ return this.log('fatal', ...args);
92
+ }
93
+ }
@@ -0,0 +1,12 @@
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
+ register(): void;
12
+ }
@@ -6,17 +6,10 @@
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
-
10
- import { Logger } from '#src/index'
11
- import { ServiceProvider } from '@athenna/ioc'
12
-
9
+ import { Logger } from '#src/Logger/Logger';
10
+ import { ServiceProvider } from '@athenna/ioc';
13
11
  export class LoggerProvider extends ServiceProvider {
14
- /**
15
- * Register any application services.
16
- *
17
- * @return {void}
18
- */
19
- register() {
20
- this.container.bind('Athenna/Core/Logger', Logger, false)
21
- }
12
+ register() {
13
+ this.container.bind('Athenna/Core/Logger', Logger, false);
14
+ }
22
15
  }
@@ -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
+ export * from './Facades/Log.js';
10
+ export * from './Logger/Logger.js';
11
+ export * from './Drivers/Driver.js';
12
+ export * from './Formatters/Formatter.js';
13
+ export * from './Logger/VanillaLogger.js';
14
+ export * from './Helpers/FactoryHelper.js';
15
+ export * from './Factories/DriverFactory.js';
16
+ export * from './Providers/LoggerProvider.js';
17
+ export * from './Factories/FormatterFactory.js';
package/build/index.js ADDED
@@ -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
+ export * from './Facades/Log.js';
10
+ export * from './Logger/Logger.js';
11
+ export * from './Drivers/Driver.js';
12
+ export * from './Formatters/Formatter.js';
13
+ export * from './Logger/VanillaLogger.js';
14
+ export * from './Helpers/FactoryHelper.js';
15
+ export * from './Factories/DriverFactory.js';
16
+ export * from './Providers/LoggerProvider.js';
17
+ export * from './Factories/FormatterFactory.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@athenna/logger",
3
- "version": "3.0.9",
3
+ "version": "3.1.1",
4
4
  "description": "The Athenna logging solution. Log in stdout, files and buckets.",
5
5
  "license": "MIT",
6
6
  "author": "João Lenon <lenon@athenna.io>",
@@ -13,7 +13,6 @@
13
13
  "telegram",
14
14
  "console",
15
15
  "debug",
16
- "pino",
17
16
  "buckets",
18
17
  "logger",
19
18
  "drivers",
@@ -22,70 +21,81 @@
22
21
  "esm"
23
22
  ],
24
23
  "scripts": {
25
- "lint:fix": "eslint \"{src,tests}/**/*.js\" --fix",
26
- "test": "npm run --silent lint:fix && node ./tests/index.js",
27
- "test:debug": "cross-env DEBUG=api:* && npm run --silent test",
28
- "test:coverage": "c8 npm run --silent test",
29
- "gen:types": "tsc src/*.js --declaration --allowJs --emitDeclarationOnly --out src/index.js"
24
+ "build": "ts-node bin/build.ts",
25
+ "lint:fix": "eslint \"{src,tests}/**/*.ts\" --fix",
26
+ "test": "npm run --silent lint:fix && ts-node bin/test.ts",
27
+ "test:debug": "cross-env DEBUG=api:* ts-node bin/test.ts --inspect",
28
+ "test:coverage": "c8 npm run --silent test"
30
29
  },
31
30
  "files": [
32
- "src/*.js",
33
- "src/*.d.ts",
34
- "src/**/*.js",
35
- "src/**/*.d.ts"
31
+ "build/*.js",
32
+ "build/*.d.ts",
33
+ "build/**/*.js",
34
+ "build/**/*.d.ts",
35
+ "templates/**"
36
36
  ],
37
37
  "type": "module",
38
- "main": "./src/index.js",
39
- "types": "./src/index.d.ts",
38
+ "main": "./build/index.js",
39
+ "types": "./build/index.d.ts",
40
40
  "imports": {
41
- "#src/*": "./src/*.js",
42
- "#tests/*": "./tests/*.js"
41
+ "#src/*": "./build/*.js",
42
+ "#src": "./build/index.js",
43
+ "#tests/*": "./tests/*.js",
44
+ "#tests": "./tests/index.js"
43
45
  },
44
46
  "exports": {
45
- ".": "./src/index.js",
46
- "./facades/Log": "./src/Facades/Log.js",
47
- "./providers/LoggerProvider": "./src/Providers/LoggerProvider.js"
47
+ ".": "./build/index.js",
48
+ "./providers/LoggerProvider": "./build/Providers/LoggerProvider.js"
48
49
  },
49
50
  "dependencies": {
50
- "chalk": "5.0.1",
51
- "telegraf": "4.7.0"
51
+ "telegraf": "^4.11.2"
52
52
  },
53
53
  "devDependencies": {
54
- "@athenna/common": "3.0.2",
55
- "@athenna/config": "3.0.4",
56
- "@athenna/ioc": "3.0.2",
57
- "@japa/assert": "1.3.4",
58
- "@japa/run-failed-tests": "1.0.7",
59
- "@japa/runner": "2.0.7",
60
- "@japa/spec-reporter": "1.1.12",
61
- "c8": "7.11.2",
62
- "cls-rtracer": "2.6.2",
63
- "commitizen": "4.2.5",
64
- "cross-env": "7.0.3",
65
- "cz-conventional-changelog": "3.3.0",
66
- "dotenv": "16.0.3",
67
- "eslint": "8.14.0",
68
- "eslint-config-prettier": "8.5.0",
69
- "eslint-config-standard": "17.0.0",
70
- "eslint-plugin-import": "2.26.0",
71
- "eslint-plugin-n": "15.2.0",
72
- "eslint-plugin-prettier": "4.0.0",
73
- "eslint-plugin-promise": "6.0.0",
74
- "husky": "3.0.9",
75
- "lint-staged": "12.4.1",
76
- "minimist": "1.2.6",
77
- "prettier": "2.6.2",
78
- "rimraf": "3.0.2",
79
- "typescript": "4.6.4"
54
+ "@athenna/common": "^3.0.0",
55
+ "@athenna/config": "^3.0.0",
56
+ "@athenna/ioc": "^3.0.0",
57
+ "@japa/assert": "^1.3.6",
58
+ "@japa/run-failed-tests": "^1.1.0",
59
+ "@japa/runner": "^2.2.2",
60
+ "@japa/spec-reporter": "^1.3.2",
61
+ "@swc/core": "^1.3.27",
62
+ "@types/bytes": "^3.1.1",
63
+ "@types/callsite": "^1.0.31",
64
+ "@types/debug": "^4.1.7",
65
+ "@types/kind-of": "^6.0.0",
66
+ "@types/lodash": "^4.14.191",
67
+ "@types/ms": "^0.7.31",
68
+ "@types/pluralize": "^0.0.29",
69
+ "@types/uuid": "^9.0.0",
70
+ "@typescript-eslint/eslint-plugin": "^5.48.1",
71
+ "@typescript-eslint/parser": "^5.48.1",
72
+ "c8": "^7.12.0",
73
+ "cls-rtracer": "^2.6.2",
74
+ "commitizen": "^4.2.6",
75
+ "cross-env": "^7.0.3",
76
+ "cz-conventional-changelog": "^3.3.0",
77
+ "eslint": "^8.32.0",
78
+ "eslint-config-prettier": "^8.6.0",
79
+ "eslint-config-standard": "^17.0.0",
80
+ "eslint-plugin-import": "^2.27.5",
81
+ "eslint-plugin-n": "^15.6.1",
82
+ "eslint-plugin-prettier": "^4.2.1",
83
+ "eslint-plugin-promise": "^6.1.1",
84
+ "husky": "^3.1.0",
85
+ "lint-staged": "^12.5.0",
86
+ "minimist": "^1.2.7",
87
+ "prettier": "^2.8.3",
88
+ "reflect-metadata": "^0.1.13",
89
+ "rimraf": "^3.0.2",
90
+ "ts-node": "^10.9.1",
91
+ "typescript": "^4.9.4"
80
92
  },
81
93
  "c8": {
82
94
  "all": true,
83
95
  "include": [
84
- "src/**/*.js"
85
- ],
86
- "exclude": [
87
- "src/Helpers/ColorHelper.js"
96
+ "src/**/*.ts"
88
97
  ],
98
+ "exclude": [],
89
99
  "reporter": [
90
100
  "text-summary",
91
101
  "html"
@@ -129,6 +139,9 @@
129
139
  }
130
140
  ]
131
141
  },
142
+ "eslintIgnore": [
143
+ "build/**/*"
144
+ ],
132
145
  "eslintConfig": {
133
146
  "env": {
134
147
  "es2021": true,
@@ -138,28 +151,36 @@
138
151
  "ioc": true,
139
152
  "Env": true,
140
153
  "Path": true,
141
- "Config": true
154
+ "Config": true,
155
+ "container": true
142
156
  },
143
157
  "plugins": [
144
- "prettier"
158
+ "prettier",
159
+ "@typescript-eslint"
145
160
  ],
146
161
  "extends": [
147
162
  "standard",
148
163
  "eslint:recommended",
149
- "plugin:prettier/recommended"
150
- ],
151
- "ignorePatterns": [
152
- "**/*.d.ts"
164
+ "plugin:prettier/recommended",
165
+ "plugin:@typescript-eslint/recommended",
166
+ "plugin:@typescript-eslint/eslint-recommended"
153
167
  ],
154
- "parserOptions": {
155
- "ecmaVersion": "latest",
156
- "sourceType": "module"
157
- },
168
+ "parser": "@typescript-eslint/parser",
158
169
  "rules": {
159
170
  "camelcase": "off",
160
171
  "dot-notation": "off",
161
172
  "prettier/prettier": "error",
162
- "no-useless-constructor": "off"
173
+ "no-useless-constructor": "off",
174
+ "@typescript-eslint/no-explicit-any": "off",
175
+ "@typescript-eslint/no-empty-function": "off",
176
+ "@typescript-eslint/no-unused-vars": [
177
+ "error",
178
+ {
179
+ "argsIgnorePattern": "^_",
180
+ "varsIgnorePattern": "^_",
181
+ "caughtErrorsIgnorePattern": "^_"
182
+ }
183
+ ]
163
184
  }
164
185
  }
165
186
  }
@@ -1,40 +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
-
10
- import { Driver } from '#src/Drivers/Driver'
11
-
12
- export class ConsoleDriver extends Driver {
13
- /**
14
- * Creates a new instance of ConsoleDriver.
15
- *
16
- * @param {any} configs
17
- * @return {ConsoleDriver}
18
- */
19
- constructor(configs) {
20
- super(configs)
21
- }
22
-
23
- /**
24
- * Transport the log.
25
- *
26
- * @param {string} level
27
- * @param {any} message
28
- * @return {any}
29
- */
30
- transport(level, message) {
31
- if (!this.couldBeTransported(level)) {
32
- return
33
- }
34
-
35
- const formatted = this.format(level, message)
36
- const streamType = this.getStreamTypeFor(level)
37
-
38
- return process[streamType].write(`${formatted}\n`)
39
- }
40
- }