@athenna/logger 3.0.0 → 3.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@athenna/logger",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
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>",
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "@athenna/common": "3.0.0",
55
- "@athenna/config": "3.0.0",
55
+ "@athenna/config": "3.0.1",
56
56
  "@athenna/ioc": "3.0.0",
57
57
  "@japa/assert": "1.3.4",
58
58
  "@japa/run-failed-tests": "1.0.7",
@@ -62,7 +62,7 @@
62
62
  "commitizen": "4.2.5",
63
63
  "cross-env": "7.0.3",
64
64
  "cz-conventional-changelog": "3.3.0",
65
- "dotenv": "^16.0.3",
65
+ "dotenv": "16.0.3",
66
66
  "eslint": "8.14.0",
67
67
  "eslint-config-prettier": "8.5.0",
68
68
  "eslint-config-standard": "17.0.0",
@@ -7,32 +7,30 @@
7
7
  * file that was distributed with this source code.
8
8
  */
9
9
 
10
- import { Config } from '@athenna/config'
11
- import { Exception } from '@athenna/common'
10
+ import { Path, Exception } from '@athenna/common'
12
11
 
13
12
  export class NotImplementedConfigException extends Exception {
14
13
  /**
15
14
  * Creates a new instance of NotImplementedConfigException.
16
15
  *
17
16
  * @param {string} channelName
17
+ * @param {any[]} channels
18
18
  * @return {NotImplementedConfigException}
19
19
  */
20
- constructor(channelName) {
21
- const content = `Channel ${channelName} is not configured inside logging.channels object from config/logging file.`
20
+ constructor(channelName, channels) {
21
+ const content = `Channel ${channelName} is not configured inside logging.channels object from config/logging.${Path.ext()} file.`
22
22
 
23
23
  let help = ''
24
24
 
25
- if (Config.get('logging.channels')) {
26
- const availableConfigs = Object.keys(Config.get('logging.channels')).join(
27
- ', ',
28
- )
25
+ if (channels && channels.length) {
26
+ const availableConfigs = Object.keys(channels).join(', ')
29
27
 
30
28
  help += `Available configurations are: ${availableConfigs}.`
31
29
  } else {
32
- help += `The "Config.get('logging.channels') is empty, maybe your configuration files are not loaded?`
30
+ help += `The "Config.get('logging.channels')" is empty, maybe your configuration files are not loaded?`
33
31
  }
34
32
 
35
- help += ` Create your configuration inside channels object to use it. Or load your configuration files using "Config.safeLoad(Path.config('logging.js'))`
33
+ help += ` Create your configuration inside channels object to use it. Or load your configuration files using "Config.safeLoad(Path.config('logging.${Path.ext()}'))`
36
34
 
37
35
  super(content, 500, 'E_NOT_IMPLEMENTED_CONFIG_ERROR', help)
38
36
  }
@@ -91,7 +91,7 @@ export class DriverFactory {
91
91
  */
92
92
  static #getChannelConfig(channelName) {
93
93
  if (channelName === 'default') {
94
- channelName = Config.get('logging.default')
94
+ channelName = Config.get('logging.default') || channelName
95
95
  }
96
96
 
97
97
  const channelConfig = Config.get(`logging.channels.${channelName}`)