Skip to content

server filters working? #41

Open
Open

Description

@duffar

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.

Activity

  1. duffar commented on Jul 24, 2018

    @duffar
    Author

    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.

  2. duffar commented on Jul 24, 2018

    @duffar
    Author

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions