使用 good-http 插件问题登录 hapijs 服务器

logging in hapijs server with good-http plugin issue

我正在使用 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 不工作!

这是我的配置:

     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}
                    }
                }
            ]
        }
    ]

唯一有效的参数是 error: *, ...ops: * 和 none 有效

我的配置参数中是否遗漏了什么?

也许您应该更改插件的 threshold 参数,默认设置为 20,因此它仅在 20 个事件后发送数据。如果你想要立竿见影的结果,你必须把它改成 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}
                }
            }
        ]
    }
]