diff --git a/package.json b/package.json index e860e03..4c366bb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@athenna/logger", - "version": "1.0.0", + "version": "1.0.1", "description": "", "license": "MIT", "author": "João Lenon ", diff --git a/src/Logger.ts b/src/Logger.ts index d1e92c7..4bdfa53 100644 --- a/src/Logger.ts +++ b/src/Logger.ts @@ -48,6 +48,13 @@ export class Logger { async log(message: any, options?: any) { options = Object.assign({}, { context: 'Logger' }, options) + if (this.runtimeConfig && this.runtimeConfig.formatter) { + options = { + ...options, + ...this.runtimeConfig.formatter, + } + } + await this.driver.transport(message, options) } @@ -58,6 +65,13 @@ export class Logger { options.color = Color.cyan options.streamType = 'stdout' + if (this.runtimeConfig && this.runtimeConfig.formatter) { + options = { + ...options, + ...this.runtimeConfig.formatter, + } + } + await this.driver.transport(message, options) } @@ -68,6 +82,13 @@ export class Logger { options.color = Color.orange options.streamType = 'stdout' + if (this.runtimeConfig && this.runtimeConfig.formatter) { + options = { + ...options, + ...this.runtimeConfig.formatter, + } + } + await this.driver.transport(message, options) } @@ -78,6 +99,13 @@ export class Logger { options.color = Color.red options.streamType = 'stderr' + if (this.runtimeConfig && this.runtimeConfig.formatter) { + options = { + ...options, + ...this.runtimeConfig.formatter, + } + } + await this.driver.transport(message, options) } @@ -88,6 +116,13 @@ export class Logger { options.color = Color.purple options.streamType = 'stdout' + if (this.runtimeConfig && this.runtimeConfig.formatter) { + options = { + ...options, + ...this.runtimeConfig.formatter, + } + } + await this.driver.transport(message, options) } @@ -98,6 +133,13 @@ export class Logger { options.color = Color.green options.streamType = 'stdout' + if (this.runtimeConfig && this.runtimeConfig.formatter) { + options = { + ...options, + ...this.runtimeConfig.formatter, + } + } + await this.driver.transport(message, options) } }