@athenna/logger 5.16.0 → 5.17.0

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": "5.16.0",
3
+ "version": "5.17.0",
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>",
@@ -9,15 +9,22 @@
9
9
  import { debug } from '#src/debug';
10
10
  import { Json } from '@athenna/common';
11
11
  import { Driver } from '#src/drivers/Driver';
12
+ import { FactoryHelper } from '#src/helpers/FactoryHelper';
12
13
  import { DriverFactory } from '#src/factories/DriverFactory';
13
14
  export class StackDriver extends Driver {
14
15
  transport(level, message) {
15
16
  const configs = Json.copy(this.configs);
17
+ const sharedConfigs = Json.copy(this.configs);
16
18
  delete configs.driver;
17
19
  delete configs.channels;
20
+ delete sharedConfigs.driver;
21
+ delete sharedConfigs.channels;
22
+ this.driverConfig.channels.forEach(channel => {
23
+ delete sharedConfigs[channel];
24
+ });
18
25
  debug('[%s] Transporting logs in channels: %s.', StackDriver.name, this.driverConfig.channels.join(', '));
19
26
  const promises = this.driverConfig.channels.map(channel => {
20
- const channelConfig = configs?.[channel];
27
+ const channelConfig = FactoryHelper.groupConfigs(configs?.[channel] || {}, sharedConfigs);
21
28
  return DriverFactory.fabricate(channel, channelConfig).transport(level, message);
22
29
  });
23
30
  return Promise.all(promises);