Coder Social home page Coder Social logo

good-console's Introduction

@hapi/good-console

Console reporting for good console monitor.

good-console is part of the hapi ecosystem and was designed to work seamlessly with the hapi web framework and its other components (but works great on its own or with other frameworks). If you are using a different web framework and find this module useful, check out hapi – they work even better together.

Visit the hapi.dev Developer Portal for tutorials, documentation, and support

Useful resources

Note: this module is being deprecated on December 31st, 2020 due to lack to available support resources. Please consider using another logging plugin.

good-console's People

Contributors

arb avatar auzwang avatar berzniz avatar calmdev avatar cjihrig avatar danielo515 avatar fhemberger avatar geek avatar genediazjr avatar hueniverse avatar jarrodyellets avatar krohrsb avatar leobudima avatar lloydbenson avatar mmcgahan avatar nallenscott avatar nargonath avatar paulovieira avatar stjohnjohnson avatar thebergamo avatar travi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

good-console's Issues

Update Tag Display

For "unknown" event types, update the tag display to be smarter in the absence of tags.

Remove timeString

timeString is only there to help with time testing and doesn't need to be public. Remove this method and update tests to not need it.

Update to new interface

This should no longer pipe directly into process.stdout. This should be just another transform stream that pushes strings to the next stream in the pipeline. It should also not do any filtering.

http status is 200 or 404, no output

var Hapi = require('hapi');
var server = new Hapi.Server();
server.connection({ host: 'localhost', port: '3000' });


server.route({
    method: 'GET',
    path: '/hello',
    handler: function (request, reply) {
        return reply("hello world");
    }
});
var options = {
    logRequestHeaders: true,
    reporters: [{
        reporter: require('good-console'),
        args:[{ log: '*', request: '*' }]
    }]
};

server.register({
    register: require('good'),
    options: options
}, function (err) {

    if (err) {
        console.error(err);
    }
    else {
        server.start(function () {

            console.info('Server started at ' + server.info.uri);
        });
    }
});

start command:

# node app2.js 
Server started at http://localhost:3000

Using good 5.0.0-rc1、good-console 3.0.0 、hapi 8.0.0、

request.log tagged as error

is there a way to have Error object logged to request.log with a tag of error printed in the same way as an error event type? the current formatting hides most of the valuable information from the console output.

good-console seems not doing anything

good 6.1.2, good-console 5.0.0.
The constructor is called correctly. The init function is called once.
Afterwards nothing happens anymore.
The options:

var goodOptions = {
    opsInterval: 1000,
    responseEvent: 'tail',
    requestHeaders: true,
    reporters: [{
        reporter: require('good-console'),
        events: [{
            response: '*',
            error: '*',
            log: '*',
            request: '*',
        ops: '*'
        }]
    }]
};

It doesn't make any difference whether I start the server via pm2 (with their own log and err files) or directly in the console.
Running the code in 'good' (the __server.js) produces the same result (none) but the good-file reporter works fine.

Does anyone has an idea about what is wrong?

Tag Display

The way hapi8 sends tags has changed so the tag display logic will need to be updated to address that.

Incorrect internalError reporting

It prints undefined instead of actual values:

141211/135646.136, internalError, message: undefined stack: undefined

I guess it needs to use eventData.error.… instead of eventData.… in _report().

warning: possible EventEmitter memory leak detected. 11 finish listeners added.

I experience in my tests that somehow the logging stream is not cleaned up when my server shuts down.

I created a testcase that starts and stops the server 11 times and the 11th time, this error occurs:

(node) warning: possible EventEmitter memory leak detected. 11 finish listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at Socket.addListener (events.js:239:17)
    at Socket.Readable.on (_stream_readable.js:655:33)
    at Socket.once (events.js:265:8)
    at DestroyableTransform.Readable.pipe (/Users/marc/Sites/hapigamb/node_modules/good-console/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:581:8)
    at internals.GoodConsole.init (/Users/marc/Sites/hapigamb/node_modules/good-console/lib/index.js:101:9)
    at /Users/marc/Sites/hapigamb/node_modules/good/lib/monitor.js:163:18
    at iterate (/Users/marc/Sites/hapigamb/node_modules/good/node_modules/items/lib/index.js:35:13)
    at Object.exports.serial (/Users/marc/Sites/hapigamb/node_modules/good/node_modules/items/lib/index.js:38:9)
    at internals.Monitor.start (/Users/marc/Sites/hapigamb/node_modules/good/lib/monitor.js:126:11)
    at Object.exports.register (/Users/marc/Sites/hapigamb/node_modules/good/lib/index.js:17:20)
    at Object.target [as register] (/Users/marc/Sites/hapigamb/node_modules/hapi/node_modules/joi/lib/object.js:79:30)
    at Items.serial.self.root._registring (/Users/marc/Sites/hapigamb/node_modules/hapi/lib/plugin.js:317:14)
    at iterate (/Users/marc/Sites/hapigamb/node_modules/hapi/node_modules/items/lib/index.js:35:13)
    at Object.exports.serial (/Users/marc/Sites/hapigamb/node_modules/hapi/node_modules/items/lib/index.js:38:9)
    at internals.Plugin.register (/Users/marc/Sites/hapigamb/node_modules/hapi/lib/plugin.js:249:11)
    at /Users/marc/Sites/hapigamb/node_modules/glue/lib/index.js:109:20
    at iterate (/Users/marc/Sites/hapigamb/node_modules/glue/node_modules/items/lib/index.js:35:13)
    at Object.exports.serial (/Users/marc/Sites/hapigamb/node_modules/glue/node_modules/items/lib/index.js:38:9)
    at /Users/marc/Sites/hapigamb/node_modules/glue/lib/index.js:107:15
    at /Users/marc/Sites/hapigamb/node_modules/glue/lib/index.js:115:9
    at iterate (/Users/marc/Sites/hapigamb/node_modules/glue/node_modules/items/lib/index.js:35:13)
    at done (/Users/marc/Sites/hapigamb/node_modules/glue/node_modules/items/lib/index.js:27:25)
    at /Users/marc/Sites/hapigamb/node_modules/glue/lib/index.js:77:13
    at /Users/marc/Sites/hapigamb/node_modules/glue/lib/index.js:115:9
    at iterate (/Users/marc/Sites/hapigamb/node_modules/glue/node_modules/items/lib/index.js:35:13)
    at done (/Users/marc/Sites/hapigamb/node_modules/glue/node_modules/items/lib/index.js:27:25)
    at /Users/marc/Sites/hapigamb/node_modules/glue/lib/index.js:68:9
    at /Users/marc/Sites/hapigamb/node_modules/glue/lib/index.js:115:9
    at iterate (/Users/marc/Sites/hapigamb/node_modules/glue/node_modules/items/lib/index.js:35:13)
    at done (/Users/marc/Sites/hapigamb/node_modules/glue/node_modules/items/lib/index.js:27:25)
    at /Users/marc/Sites/hapigamb/node_modules/glue/lib/index.js:50:13
    at /Users/marc/Sites/hapigamb/node_modules/glue/lib/index.js:115:9
    at iterate (/Users/marc/Sites/hapigamb/node_modules/glue/node_modules/items/lib/index.js:35:13)
    at Object.exports.serial (/Users/marc/Sites/hapigamb/node_modules/glue/node_modules/items/lib/index.js:38:9)
    at Object.exports.compose (/Users/marc/Sites/hapigamb/node_modules/glue/lib/index.js:113:11)
    at compose (/Users/marc/Sites/hapigamb/lib/happier/server.js:85:10)
    at Object.start (/Users/marc/Sites/hapigamb/lib/happier/server.js:92:5)
    at /Users/marc/Sites/hapigamb/test/index.spec.js:86:22
    at Immediate._onImmediate (/Users/marc/Sites/hapigamb/node_modules/lab/lib/runner.js:455:17)
    at processImmediate [as _immediateCallback] (timers.js:374:17)

Unable to turn off ops logs

I'm trying to configure good-console to show only http request / response, and there doesn't appear to be any way to turn off the ops messages:

161120/052304.141, [ops] memory: 67Mb, uptime (seconds): 15.871, load: [1.57563259375,1.7333911375,1.69970603125]

Is there a way to do this? I have tried all kinds of configurations, e.g.

    register: require('good'),
    options: {
      reporters: {
        goodConsoleReporter: [{
          module: 'good-console',
          args: [{ request: '*', response: '*', ops: false, log: false, error: false }]
        }, 'stdout']
      }
    }

Cannot assign to read only property 'data'

Getting the following error when logging response: '*'

Debug: internal, implementation, error
    TypeError: Cannot assign to read only property 'data' of {"event":"response","timestamp":1469029941159,"id":"1469029941159:LH7U0CND425599X:14712:iqv2ht5p:10000","instance":"http://LH7U0CND425599X:3100","labels":[],"method":"get","path":"/enrollment","query":{},"responseTime":71,"statusCode":200,"pid":14712,"httpVersion":"1.1","source":{"remoteAddress":"127.0.0.1","userAgent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"},"route":"/enrollment","log":[{"request":"1469029941159:LH7U0CND425599X:14712:iqv2ht5p:10000","timestamp":1469029941166,"tags":["received"],"data":{"method":"get","url":"/enrollment","agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"},"internal":true},{"request":"1469029941159:LH7U0CND425599X:14712:iqv2ht5p:10000","timestamp":1469029941188,"tags":["handler"],"data":{"msec":15.78422800078988},"internal":true},{"request":"1469029941159:LH7U0CND425599X:14712:iqv2ht5p:10000","timestamp":1469029941229,"tags":["response"],"internal":true}],"config":{}}

    at GoodConsole._transform (\node_modules\good-console\lib\index.js:174:23)

Running versions

    "good": "^7.0.1",
    "good-console": "^6.1.2",
    "good-squeeze": "^4.0.0",
    "hapi": "^13.3.0",

Configuration

{
    register: require('good'),
    options: {
        reporters: {
            console: [
                {
                    module: 'good-squeeze',
                    name: 'Squeeze',
                    args: [{ error: '*', log: '*', response: '*', request: '*' }]
                },
                {
                    module: 'good-squeeze',
                    name: 'SafeJson'
                },
                {
                    module: 'good-console'
                },
                'stdout'
            ]
        }
    }
}

GoodConsole.prototype._report missing handler for 'log' event

Running the hapi tutorial, it has a section to add the good and good-console plugins. However the log printout from the tutorial code is not what is expected. the tutorial expects :
"140625/143008.751, info, Server running at: http://localhost:3000"
but the example actually outputs
"Unknown event "log" occurred with timestamp 141219/185801.403"

this occurs because the good-console function _report does not have a handler for the 'log' event. it only has ops,response, error and request.

Wrong version number

hi @arb ,

i think the last release was published with the wrong version number. I was using v6.3.1 but on the releases page and on npm outdated it says the latest version is v6.2.0.

I just want to print the good console logs with time, please find the below code which i am using

var goodOptions = {
opsInterval: 1000
,
reporters :[
{
reporter: require('good-console'),
args:[{ log: '', request: '' }]
}
,{
reporter : require('good-file'),
args : ['hapilog.log',{ opts : '' , request : '' , log : '*'}]
}
]
};
server.pack.register([
{
plugin: require("good"),
options: goodOptions
},
{
plugin : require('../plugins/hapijwt')
}
], function(err) {
if (err) throw err;
});

Output:
server-0 (out): 170224/105245.779, request, https://0.0.0.0:8091: options /v1/logout {} 200 (40ms)
server-0 (out): 170224/105245.827, request, https://0.0.0.0:8091: post /v1/logout {} 200 (241ms)

Tag latest

When hapi8 launches, tag version 3 as latest. Peer dependencies right now would make version 3 difficult to use.

How should I use the [config] - optional configuration object?

Hello guys, I have the following code:

'use strict';
import routes from './server/routes';
import conf from '../config.js';
import Hapi from 'hapi';
import Good from 'good';
import Util from './server/lib/util';

const connectivity = {
  host: conf.APP.host,
  address: conf.APP.address,
  port: conf.APP.port
};

const goodOptions = {
  register: Good,
  options: {
    ops: {
      interval: Util.rightTime(conf.LOG.console.intervalType, conf.LOG.console.intervalTime)
    },
    reporters: {
      consoleReporter: [{ module: 'good-console' }, 'stdout']
    }
  }
};

const server = new Hapi.Server();
server.debug = false;
server.connection(connectivity);
server.register([
  goodOptions
], function(err) {
  if (err) {
    return console.error(err);
  }
  server.log('info', `Admin API - Server Starting...`);
  server.route(routes);
  server.log('info', `Admin API - Server Routes loaded...`);
  server.start(function(err) {
    if (err) {
      server.log('error', 'Admin API - Failed to start server');
      server.log('error', err);
      throw err;
    }
    server.log('info', `Admin API - Server started at ${ server.info.uri }`);
  });
});

My app is working perfectly but for the console log from Good, it is like this:

image

I want to show that log in a different datetime format, for example:
YYYY-MM-DD HH:mm:ss, and I want to use my local server time, and not UTC

I've found this in your README
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.

And prepared this

  config: {
    format: 'YYYYMMDD/HHmmss.SSS',
    utc: false,
    color: true
  }

But it doesn't matter where I set this code, the log keeps showing the info with the default configuration.
Could you please tell me where should I set the config json considering the code I am posting here?

Cheers.

missing init method "Error: Every reporter object must have an init method"

Below are my server settings and when i start server
I am getting Error: Every reporter object must have an init method

Error: Every reporter object must have an init method

var Good = require('good');
server.register({
    register: Good,
    options: {
        reporters: [{
            reporter: require('good-console'),
            events:{ log: '*', response: '*' }
        }]
    } }, function (err) {
    if (err) {
        throw err; // something bad happened loading the plugin
    }
    server.start(function () {
        server.log('info', 'Server running at: ' + server.info.uri);
    }); });

Error: Every reporter object must have an init method

I try to use good 6.0.0 and good-console 6.0.0. I'm currtently using node 4.4.2 and hapijs 13.3.0
Error from terminal
Error: Every reporter object must have an init method
at Object.exports.assert (/Users/juliomelo/Projects/findtruck/rest/node_modules/good/node_modules/hoek/lib/index.js:731:11)
at /Users/juliomelo/Projects/findtruck/rest/node_modules/good/lib/monitor.js:147:14
at iterate (/Users/juliomelo/Projects/findtruck/rest/node_modules/good/node_modules/items/lib/index.js:35:13)
at Object.exports.serial (/Users/juliomelo/Projects/findtruck/rest/node_modules/good/node_modules/items/lib/index.js:38:9)
at internals.Monitor.start (/Users/juliomelo/Projects/findtruck/rest/node_modules/good/lib/monitor.js:123:11)
at Object.exports.register (/Users/juliomelo/Projects/findtruck/rest/node_modules/good/lib/index.js:17:20)
at Object.target as register
at each (/Users/juliomelo/Projects/findtruck/rest/node_modules/hapi/lib/plugin.js:317:14)
at iterate (/Users/juliomelo/Projects/findtruck/rest/node_modules/hapi/node_modules/items/lib/index.js:36:13)
at Object.exports.serial (/Users/juliomelo/Projects/findtruck/rest/node_modules/hapi/node_modules/items/lib/index.js:39:9)
at module.exports.internals.Plugin.parent.auth.internals.Plugin.register.each as register
at setup (/Users/juliomelo/Projects/findtruck/rest/server.js:26:9)
at Object. (/Users/juliomelo/Projects/findtruck/rest/server.js:44:3)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)

Refactor Output

Refactor and update logging out put so there are fewer branches and fewer edge cases. This will be a breaking change because the console output will likely change.

Good options logRequestHeaders and logRequestPayload not logged to console

Expected
When logRequestHeaders and logRequestPayload are set to true, it's expected that good-console will log the headers and payload directly to console.

Actual
good-console does not log either request header or post payload

Example Options

var options = {
    opsInterval: 1000,
    reporters: [{
      reporter: require('good-console'),
      args:[{ log: '*', request: '*', response: '*' }]
    }],
    logRequestHeaders: true,
    logRequestPayload: true,
    logResponsePayload: true
  }

Unknown Events

Change behavior of "unknown events" to just print out a warning message. There isn't a reliable or safe way to print this message without knowing more about the event. Since it's an "unknown" event type, we don't know for sure how to print it.

Log the events in a response tail?

Hi there,

I've been trying to work out why I can't seem to log details like response validation and I think I've got to the bottom of it. These details end up in the request tail in an array-valued log property.

It seems fairly straightforward to iterate over the entries in this array and log them as well but I thought I'd check there's no reason good-console doesn't already do this!

To see the log, I added a loop to the GoodConsole class:

        ...
        tags.unshift(eventName);

        if (data.log) {
          for (let entry of data.log) {
            console.log(JSON.stringify(entry));
          }
        }

        if (eventName === 'error') {
            return next(null, internals.utility.formatError(data, tags, this._settings));
        }
        ...

Output:

19:10:18 web.1   |  {"request":"1505153418814:localhost.localdomain:25718:j7ghhdc9:10000","timestamp":1505153418816,"tags":["received"],"data":{"method":"get","url":"/foo/bar","agent":"HTTPie/0.9.4"},"internal":true}
19:10:18 web.1   |  {"request":"1505153418814:localhost.localdomain:25718:j7ghhdc9:10000","timestamp":1505153418821,"tags":["auth","jwt"],"internal":true}
19:10:18 web.1   |  {"request":"1505153418814:localhost.localdomain:25718:j7ghhdc9:10000","timestamp":1505153418835,"tags":["handler"],"data":{"msec":13.656393002718687},"internal":true}
19:10:18 web.1   |  {"request":"1505153418814:localhost.localdomain:25718:j7ghhdc9:10000","timestamp":1505153418839,"tags":["validation","response","error"],"data":"child \"links\" fails because [\"links\" must be an array]","internal":true}
19:10:18 web.1   |  {"request":"1505153418814:localhost.localdomain:25718:j7ghhdc9:10000","timestamp":1505153418847,"tags":["response"],"internal":true}
19:10:18 web.1   |  170911/181018.814, [response] http://localhost.localdomain:5000: get /foo/bar {} 200 (34ms)

My Hapi logging settings:

server.register({
      register: require('good'),
      options: {
        reporters: {
          consoleReporter: [{
            module: 'good-squeeze',
            name: 'Squeeze',
            args: [{
              log: '*',
              error: '*',
              response: '*',
              request: '*'
            }]
          }, {
            module: 'good-console',
            args: []
          }, 'stdout'],
        }
      },
    },
    function(err) {
      if (err) { server.log(['error'], err); };
    });

I also needed to add a boolean flag to my route settings (I added it as a route default, but it works per-route too)

routes: {
    log: true,
   ...
}

Is there any reason good-console doesn't do this, or would be a nice addition?

Cheers

wreck events are not formatted correctly in console logging

using the below config i see other logs but wreck event is logged twice and no data.
"good": "7.x.x",
"good-console": "6.x.x",
"good-squeeze": "5.x.x",
"hapi": "16.x.x",
"wreck": "10.x.x"

goodOpts: {
        wreck: true,
        reporters: {
            console: [{
                module: 'good-squeeze',
                name: 'Squeeze',
                args: [{ request: '*', error: '*', response: '*', wreck: '*', log: '*' }]
            }, {
                module: 'good-console'
            }, 'stdout']
        }
    }

Output

170524/132408.679, [wreck] data: (none)
170524/132408.679, [wreck] data: (none)
170524/132408.944, [wreck] data: (none)
170524/132408.945, [wreck] data: (none)

These are two wreck events each logged twice.
I saw that there is no formatting for wreck event in good-console hence data is printed as (none).. is that correct ?

Timezone offset - Disable UTC mode from Momentjs

Currently the UTC mode from Momentjs is being used. This disables the timezone offset and is always set to 0.

http://momentjs.com/docs/#/parsing/utc/

Could you remove that UTC mode? You simply need to create Moment objects without calling to the utc() function, just doing Moment(...) instead of Moment.utc(...).

I want to print the timestamp in the ISO format by passing format: '' as a parameter to the good-console reporter.

Example good integration for transforming events into strings

@arb Any chance you have an example of a simple Good integration that takes any event and converts it to a string.

Here in the good-console plugin, you do two function:

  1. convert events to strings
  2. write to stdout

I want to have a event stringifier that I could pipe to either good-file or stdout, both with the same results.. any thoughts there?

Sorry this is a bit rambling, trying to form the idea...

Error: Every reporter object must have an init method

Hi, I am currently learning to use hapi - I want to use good-console to create some kind of site analytics. I end up with the above error, see my repo ( server.js) https://github.com/lajj/picup/tree/problemwithgood

This is the entire error message from my terminal:

/Users/lukars/Desktop/FoundersCoders/makemehapi/picup/node_modules/good/node_modules/hoek/lib/index.js:723
    throw new Error(msgs.join(' ') || 'Unknown error');
          ^
Error: Every reporter object must have an init method
    at Object.exports.assert (/Users/lukars/Desktop/FoundersCoders/makemehapi/picup/node_modules/good/node_modules/hoek/lib/index.js:723:11)
    at /Users/lukars/Desktop/FoundersCoders/makemehapi/picup/node_modules/good/lib/monitor.js:148:14
    at iterate (/Users/lukars/Desktop/FoundersCoders/makemehapi/picup/node_modules/good/node_modules/items/lib/index.js:35:13)
    at Object.exports.serial (/Users/lukars/Desktop/FoundersCoders/makemehapi/picup/node_modules/good/node_modules/items/lib/index.js:38:9)
    at internals.Monitor.start (/Users/lukars/Desktop/FoundersCoders/makemehapi/picup/node_modules/good/lib/monitor.js:124:11)
    at Object.exports.register (/Users/lukars/Desktop/FoundersCoders/makemehapi/picup/node_modules/good/lib/index.js:17:20)
    at /Users/lukars/Desktop/FoundersCoders/makemehapi/picup/node_modules/hapi/lib/plugin.js:254:14
    at iterate (/Users/lukars/Desktop/FoundersCoders/makemehapi/picup/node_modules/hapi/node_modules/items/lib/index.js:35:13)
    at Object.exports.serial (/Users/lukars/Desktop/FoundersCoders/makemehapi/picup/node_modules/hapi/node_modules/items/lib/index.js:38:9)
    at internals.Plugin.register (/Users/lukars/Desktop/FoundersCoders/makemehapi/picup/node_modules/hapi/lib/plugin.js:236:11)
18 Jun 16:37:57 - [nodemon] app crashed - waiting for file changes before starting...```

Printing events of `request.log`

Maybe I got this wrong, but I use request.log to log events that are directly linked to a specific request. It would be great if good-console prints those events so I can see errors directly in the console while developing.

For example, in the following, "This is request.log" is never printed:

var Hapi = require('hapi');
var Good = require('good');

var goodOptions = {
  extendedRequests: true,
  reporters: [
    { reporter: 'good-console', args: [ { log: '*', request: '*' } ]},
  ]
};

var server = new Hapi.Server();

server.pack.register({ plugin: Good, options: goodOptions }, function(err) {

  var get = function (request, reply) {
    server.log([ 'log' ], 'This is server.log');
    console.log('This is console.log');
    request.log([ 'log' ], 'This is request.log');
    reply();
  };

  server.route({ method: 'GET', path: '/', handler: get });
  server.inject('/', function (res) {
  });

});

The output is

141201/083151.661, log, This is server.log
This is console.log
141201/083151.239, request, http://TomNewPC:80: get / {} 200 (474ms)

Update Switch Logic

The "request" event has been renamed "response". Update the logic to account for this.

responseSentTime is undefined

Hey 👋

Thanks for continuing to maintain and support this project, I really appreciate it 🙏

I seem to be getting logs like this:

2018-01-24T16:24:08Z, [response] http://localhost:3000: get /route {} 200 (responseSentTime: undefinedms) (responseTime: 14ms)

Where responseSentTime is undefinedms...

This is occurring with these dependencies:

"good": "^8.0.0-rc1",
"good-console": "^7.0.0",
"good-squeeze": "^5.0.2"
"hapi": "^17.2.0"

Any ideas?

✌️

Accepting of PR to allow format updates?

Would a PR potentially be accepted if someone wanted to allow for the log formats to be overridden? The defaults would remain true, but the feature would allow you to add format overrides to the options.

Thoughts? @arb

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.