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

Use as reporter for Hapi.js with Good #21

Closed
alainm opened this issue Oct 20, 2016 · 1 comment
Closed

Use as reporter for Hapi.js with Good #21

alainm opened this issue Oct 20, 2016 · 1 comment

Comments

@alainm
Copy link

alainm commented Oct 20, 2016

Please help me using modern-syslog as a reporter for Hapi.js using it's native plugin Good: https://github.com/hapijs/good
Modern-syslog can be used as a stream, but I cannot figure how to connect the two.

Hi, I have spent hours on this, I have found no better logging packaged :(

@rmg
Copy link
Member

rmg commented Mar 20, 2017

From skimming through the docs for options, I see that the final stream may be a string or an instantiated stream.

From the log to console example it shows something like this:

const reporters = {
    console: [{
        module: 'good-squeeze',
        name: 'Squeeze',
        args: [{
            log: '*',
            response: '*'
        }]
    }, {
        module: 'good-console'
    },
    'stdout',         // <--- uses the string form
    ],
};

To put modern-syslog in to this instead of the console we would change it to:

const syslog = require('modern-syslog');
const syslogErr = new syslog.Stream(syslog.LOG_ERR);
const const reporters = {
    console: [{
        module: 'good-squeeze',
        name: 'Squeeze',
        args: [{
            log: '*',
            response: '*'
        }]
    }, {
        module: 'good-console'
    },
    syslogErr,         // <--- uses the stream instance
    ],
};

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

3 participants