Skip to content

Commit

Permalink
Merge pull request #51 from AthennaIO/develop
Browse files Browse the repository at this point in the history
fix(formatter): import rTracer module
  • Loading branch information
jlenon7 authored Jan 13, 2023
2 parents f070753 + 80f6994 commit 96e8c7a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@athenna/logger",
"version": "3.0.4",
"version": "3.0.5",
"description": "The Athenna logging solution. Log in stdout, files and buckets.",
"license": "MIT",
"author": "João Lenon <lenon@athenna.io>",
Expand Down
13 changes: 3 additions & 10 deletions src/Formatters/Formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
* file that was distributed with this source code.
*/

import rTracer from 'cls-rtracer'

import { hostname } from 'node:os'
import { Is } from '@athenna/common'
import { createRequire } from 'node:module'
import { ColorHelper } from '#src/Helpers/ColorHelper'

const require = createRequire(import.meta.url)

export class Formatter {
/**
* Holds the configuration object of formatter.
Expand Down Expand Up @@ -73,13 +72,7 @@ export class Formatter {
* @return {string | null}
*/
traceId() {
try {
const rTracer = require('cls-rtracer')

return rTracer.id()
} catch (err) {
return null
}
return rTracer.id() || null
}

/**
Expand Down

0 comments on commit 96e8c7a

Please sign in to comment.