Skip to content

Commit

Permalink
Merge pull request #10 from lobodpav/master
Browse files Browse the repository at this point in the history
Empty meta info was added into the email body
  • Loading branch information
wavded committed Jul 9, 2013
2 parents 53e5e6d + 548cc90 commit b45b479
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/winston-mail.js
Expand Up @@ -71,10 +71,11 @@ Mail.prototype.log = function (level, msg, meta, callback) {
var self = this;
if (this.silent) return callback(null, true);

if (meta) // add some pretty printing
meta = util.inspect(meta, null, 5)
var body = msg;

var body = meta ? msg + "\n\n" + meta : msg;
// add meta info into the body if not empty
if (meta !== null && meta !== undefined && (typeof meta !== 'object' || Object.keys(meta).length > 0))
body += "\n\n" + util.inspect(meta, {depth: 5}); // add some pretty printing

var message = email.message.create({
from: this.from,
Expand Down

0 comments on commit b45b479

Please sign in to comment.