Winston: RangeError: Maximum call stack size exceeded with customize formatter

Created on 28 Apr 2016  路  8Comments  路  Source: winstonjs/winston

See below codes

var winston = require('winston');
var request = require('request');
var util = require('util');

var logger = new (winston.Logger)({
  transports: [new winston.transports.Console({
    level: 'info',
    exitOnError: false,
    json: false,
    formatter: function defaultFormatter(options) {
      console.log('formatter is called');
      return options.message + '\n' + util.inspect( options.meta, {depth: 1});
    }
  })]
});

request.get('http://www.google.com', function(err, resp){
  logger.info('Log response object.', resp);
});

When execute above code, RangeError occurs. And formatter is called is not printed in log

Similar to #100

Most helpful comment

The fix is add below code before https://github.com/winstonjs/winston/blob/master/lib/winston/common.js#L217

options.meta = meta;

Need to have options.meta decycled before clone.

All 8 comments

The fix is add below code before https://github.com/winstonjs/winston/blob/master/lib/winston/common.js#L217

options.meta = meta;

Need to have options.meta decycled before clone.

I had similar issue and the change suggested by @thinkkevin fixed the issue. Can someone please merge the PR https://github.com/winstonjs/winston/pull/868?

When this can be released?
While waiting for the fix to be released, I simply log JSON.stringify(meta, null, 2), instead of logging meta directly.

Any Updates?

I have been constantly checking #862, #474 and #914 for an update. I also have a question posted here which too hasn't gotten any response.

Rebased PR/branch for version 2.3.0

Would like to get a target release date for this fix please.

This has been published, issue can be closed out

FYI guys, I still have decycling related issues. That's why #977 proposed

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mohanen picture mohanen  路  4Comments

xungwoo picture xungwoo  路  3Comments

KingRial picture KingRial  路  3Comments

ghost picture ghost  路  4Comments

bertolo1988 picture bertolo1988  路  3Comments