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

server filters working? #41

Open
duffar opened this issue Jul 24, 2018 · 2 comments
Open

server filters working? #41

duffar opened this issue Jul 24, 2018 · 2 comments

Comments

@duffar
Copy link

duffar commented Jul 24, 2018

I modified the themes example to add some filters to block the debug level messages but I can't seem to make them work. Presumably I'm doing something wrong but it seems pretty straightforward so I'm confused. Here's the code:

var log = require('minilog')('app'),
    ConsoleBackend = require('minilog').backends.console;

function out() {
  log
    .debug('debug message')
    .info('info message')
    .warn('warning')
    .error('this is an error message');
};

var minilog = require('minilog');

console.log('\n== Default style\n');

minilog.enable();
var filter = new minilog.Filter();
filter.defaultResult = true;
filter.deny('app','debug');
minilog.pipe(filter);
out();
minilog.disable();
});

and here's the resulting output:

== Default style

app debug debug message
app info info message
app warn warning
app error this is an error message

I also tried just setting defaultResult to false and using allow rules but without success - all the messages seem to come through no matter what I try.

@duffar
Copy link
Author

duffar commented Jul 24, 2018

I also tried using the suggest mechanism instead of filter by doing this right before the enable()

minilog.suggest.clear().allow('app','warn');

again everything still comes through.

@duffar
Copy link
Author

duffar commented Jul 24, 2018

I found I could get things working by using the suggest.deny rules. For now I can work with that.

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

1 participant