Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minilog.backends.console.filterEnv breaks in version 2.0.1 #8

Closed
itsnotvalid opened this issue Jun 28, 2013 · 1 comment
Closed

Minilog.backends.console.filterEnv breaks in version 2.0.1 #8

itsnotvalid opened this issue Jun 28, 2013 · 1 comment

Comments

@itsnotvalid
Copy link

I tried to update zendesk/radar to use minilog 2 and discovered that backends.console.filterEnv may have some problem here.

Here is the init statements:

var Minilog = require('minilog');
Minilog
  .pipe(Minilog.backends.console.filterEnv((process.env.radar_log ? process.env.radar_log : '*')))
  .pipe(Minilog.backends.console.formatWithStack)
  .pipe(Minilog.backends.console);

And then it goes with the following error:

<...>/node_modules/radar/node_modules/minilog/lib/common/transform.js:28
  dest.emit('pipe', s);
       ^
TypeError: Object function filter(name, level) {
    return whitelist.some(function(expr) {
      return expr.topic && expr.topic.test(name) && levelMap[level] >= expr.level;
    });
  } has no method 'emit'
    at ConsoleBackend.Transform.pipe (<...>/node_modules/radar/node_modules/minilog/lib/common/transform.js:28:8)
    at Object.<anonymous> (<...>/node_modules/radar/server.js:17:4)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:901:3

The offending part would then be filterEnv in lib/node/console.js, and commenting that filter out in Minilog.pipe would render no problems.

@mixu
Copy link
Owner

mixu commented Jul 2, 2013

Thanks for reporting this. I've added a deprecation notice to .filterEnv in v2.0.2. The new filtering mechanism is much easier to use, so I don't think I'll do a full reimplementation of filterEnv - filtering by environment variable turned out not be a hit feature...

@mixu mixu closed this as completed Jul 2, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants