Skip to content
Console reporting for Good process monitor
Branch: master
Clone or download
Pull request Compare This branch is 26 commits ahead, 10 commits behind hapijs:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
test
.gitignore
.travis.yml
LICENSE
README.md
package.json

README.md

better-console

DISCLAIMER: This project is exactly as the good console with one extra feature, passing payloads into the console.

good-console is a transform stream useful for turning good server events into formatted strings.

Build Status Current Version

Lead Maintainer: Martin Arista

Usage

new GoodConsole([config])

Creates a new GoodConsole object with the following arguments:

  • [config] - optional configuration object with the following keys
    • format - MomentJS format string. Defaults to 'YYMMDD/HHmmss.SSS'.
    • utc - boolean controlling Moment using utc mode or not. Defaults to true.
    • color - a boolean specifying whether to output in color. Defaults to true.
    • requestPayload a boolean specifying if passed request payload will be output to console. Defaults to false.
    • responsePayload a boolean specifying if passed response payload will be output to console. Defaults to false.

Output Formats

Below are example outputs for the designated event type:

  • "ops" - 160318/013330.957, [ops] memory: 29Mb, uptime (seconds): 6, load: [1.650390625,1.6162109375,1.65234375]
  • "error" - 160318/013330.957, [error,event.tags] message: Just a simple error, stack: event.error.stack
  • "request" - 160318/013330.957, [request,event.tags] data: you made a request
  • "log" - 160318/013330.957, [log,event.tags] data: you made a default
  • "response" - 160318/013330.957, [response, event.tags] http://localhost:61253: post /data {"name":"adam"} 200 (150ms)

Example

const Logging = {
    register: require('good'),
    options: {
        reporters: {
            console: [{
                module: 'good-squeeze',
                name: 'Squeeze',
                args: [{
                    log: '*',
                    request: '*',
                    error: '*',
                }],
            }, {
                module: 'good-console',
                args: [{
                    responsePayload: true,
                }],
            }, 'stdout'],
        },
        includes: {
            request: ['payload'],
            response: ['payload'],
        },
    },
};
You can’t perform that action at this time.