Skip to content

Commit

Permalink
Merge pull request #32 from invisible-tech/lkk/timber
Browse files Browse the repository at this point in the history
Fix Timber.io Blank Messages Error
  • Loading branch information
rodrigo4244 committed Feb 14, 2018
2 parents 3b1ba10 + e03e5ec commit 4124bef
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
*v1.1.1*
> Fix: Blank messages bug when logging an Error object using Timber.io
*v1.1.0*
> Feat: Add Timber.io transport
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@invisible/logger",
"version": "1.1.0",
"version": "1.1.1",
"description": "Invisible Logging Wrapper",
"main": "index.js",
"scripts": {
Expand Down
6 changes: 5 additions & 1 deletion transports/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ if (shouldLog && TIMBER_KEY) {
transport = new (winston.transports.Console)({
name: 'console',
level: TIMBER_LEVEL,
formatter: timber.formatters.Winston,
formatter: options => {
// When we log errors, options.message comes as blank and it causes errors
const message = options.message || options.meta.message
return timber.formatters.Winston({ ...options, message })
},
})
} else if (shouldLog) {
transport = new (winston.transports.Console)({
Expand Down

0 comments on commit 4124bef

Please sign in to comment.