Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    hapi-good-winstonpublic

    hapi-good-winston

    A good reporter to send and log events with winston

    npm npm license

    CircleCI Dependency Status

    Issues PR

    Disclaimer

    Hapi-good-winston 2 only support good >= 8 and hapi >= 17

    • Use 1.* for version prior to hapi v17

    Installation

    $ npm install --save hapi-good-winston

    Usage

    import { Server } from 'hapi';
    import winston from 'winston';
    import goodWinston from 'hapi-good-winston';
     
    const server = new Server();
     
    // Set winston minimum log level to debug
    winston.level = 'debug';
     
     // Only the 'response' and 'error' event levels will be overwritten
    const goodWinstonOptions = {
        levels: {
            response: 'debug',
            error: 'info',
        }
    };
     
    const options = {
        reporters: {
            // Simple and straight forward usage
            winston: [goodWinston(winston)],
     
            // Adding some customization configuration
            winstonWithLogLevels: [goodWinston(winston, goodWinstonOptions)],
     
            // This example simply illustrates auto loading and instantiation made by good
            winston2: [{
                module: 'hapi-good-winston',
                name: 'goodWinston',
                args: [winston, goodWinstonOptions],
            }],
        },
    };
     
    server.register({
        plugin: require('good'),
        options,
    }, (err) => {
     
        if (err) {
            return console.error(err);
        }
        server.start(() => {
            console.info(`Server started at ${server.info.uri}`);
        });
     
    });

    Links

    License

    MIT

    install

    npm i hapi-good-winston

    Downloadsweekly downloads

    547

    version

    2.0.1

    license

    MIT

    repository

    githubgithub

    last publish

    collaborators

    • avatar