cabinjs / axe

:axe: Logger-agnostic wrapper that normalizes logs regardless of arg style. Great for large dev teams, old/new projects, and works w/Pino, Bunyan, Winston, console, and more. It is lightweight, performant, highly-configurable, and automatically adds OS, CPU, and Git information to your logs. Hooks, dot-notation remap, omit, and pick of metadata.
https://forwardemail.net/docs/best-practices-for-node-js-logging
MIT License
50 stars 11 forks source link

Issue while using with email-templates + Nodemaier #6

Closed wassimz closed 6 years ago

wassimz commented 6 years ago

While I am testing the email-template plugin + nodemailer (using gmail trasnport), I got this issue

TypeError: meta must be an object not a string at Logger.log (\node_modules\@ladjs\logger\index.js:115:13) at Logger.(anonymous function) [as info] (\node_modules\@ladjs\logger\index.js:70:14) at Object..module.exports._logFunc.args [as _logFunc] (node_modules\nodemailer\lib\shared\index.js:108:18) at Object.response.(anonymous function).args [as info] (node_modules\nodemailer\lib\shared\index.js:141:28) at SMTPConnection._onConnect (\node_modules\nodemailer\lib\smtp-connection\index.js:467:21)

This happens when nodemailer try to log information using this module.

Any hints ??

OmgImAlexis commented 6 years ago

Can you please provide us a reproducible code sample so we can look further into this.

niftylettuce commented 6 years ago

it's because the second argument that is being passed to the logger is not an object, it's a string.

https://github.com/nodemailer/nodemailer/blob/master/lib/smtp-connection/index.js#L467-L479

we should probably interpret a second argument (and other args) that's a string passed to logger as a util.format instance

niftylettuce commented 6 years ago

I just finished writing the patch for this and will release a new version soon, and will also update email-templates. Give me a moment

niftylettuce commented 6 years ago

Please upgrade to v0.0.7+ of @ladjs/logger via npm install @ladjs/logger@latest or yarn add @ladjs/logger@latest. Also make sure you upgrade your usage of koa-meta, as there is a newer version released of that too npm install koa-meta@latest or yarn add koa-meta@latest.

niftylettuce commented 6 years ago

If you are using @ladjs/web, you can upgrade that as well.