Search code examples
hapi.js

logging in hapijs server with good-http plugin issue


I'm using good plugin for my app, and I have copied the config parameters straight from the sample in the page, console and file are working , but good-http is not working!

here is my configuration:

     myHTTPReporter: [
        {
            module: 'good-squeeze',
            name: 'Squeeze',
            args: [{error: '*', log: 'error', request: 'error'}]
        },
        {
            module: 'good-http',
            args: [
                'http://localhost/log-request/index.php?test=23424', // <- test file I created to see if data is being sent or not
                {
                    wreck: {
                        headers: {'x-api-key': 12345}
                    }
                }
            ]
        }
    ]

the only argument that is actually working is the ops: * and none of the error: *, ... is working

Am I missing something in my config parameters?


Solution

  • Maybe you should change the threshold parameter of the plugin, is set by default to 20 so it only send data after 20 events. If you want immediate results yo have to change it to 0.

    myHTTPReporter: [
        {
            module: 'good-squeeze',
            name: 'Squeeze',
            args: [{error: '*', log: 'error', request: 'error'}]
        },
        {
            module: 'good-http',
            args: [
                'http://localhost/log-request/index.php?test=23424', // <- test file I created to see if data is being sent or not
                {
                    threshold: 0,
                    wreck: {
                        headers: {'x-api-key': 12345}
                    }
                }
            ]
        }
    ]