@athenna/logger 5.11.0 → 5.12.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.11.0",
3
+ "version": "5.12.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>",
@@ -6,9 +6,9 @@
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
- import { Driver } from '#src/drivers/Driver';
10
- import { HttpClient } from '@athenna/common';
11
9
  import { debug } from '#src/debug';
10
+ import { Driver } from '#src/drivers/Driver';
11
+ import { HttpClient, Is } from '@athenna/common';
12
12
  export class SlackDriver extends Driver {
13
13
  async transport(level, message) {
14
14
  if (!this.couldBeTransported(level)) {
@@ -16,10 +16,13 @@ export class SlackDriver extends Driver {
16
16
  }
17
17
  const formatted = this.format(level, message, true);
18
18
  debug('[%s] Transporting logs in url %s.', SlackDriver.name, this.configs.url);
19
+ if (Is.Object(formatted) && formatted.text && formatted.blocks) {
20
+ return HttpClient.builder(true).post(this.configs.url, {
21
+ body: { text: formatted.text, blocks: formatted.blocks }
22
+ });
23
+ }
19
24
  return HttpClient.builder(true).post(this.configs.url, {
20
- body: {
21
- text: formatted
22
- }
25
+ body: { text: formatted }
23
26
  });
24
27
  }
25
28
  }