jonobattle
jonobattle

Reputation: 113

Better console output in HapiJS?

I feel like I'm missing something basic, but I can't work out how to get better console output in HapiJS.

I am writing an API, and at the moment when there is an error it prints out.

150516/063815.663, [response], http://localhost:3000: post /users{} 500 (120ms)

And returns a response saying "there was an internal server error".

What do I need to change to see what that error output actually was?

Upvotes: 2

Views: 949

Answers (2)

Doron Segal
Doron Segal

Reputation: 2260

There are number of ways to log your Hapi.js project

  1. Bucker - instance logger made by some hapi dude
  2. Good - Good - hapijs plugin style
  3. Winston - probably one of the most common logger for node.js

Upvotes: 1

Clarkie
Clarkie

Reputation: 7550

It looks like you're using the Good plugin.

If so, you can change the console reporter to include Error logs by adding error: '*' to the events hash.

 reporters: [{
    reporter: require('good-console'),
    events: { log: '*', response: '*', error: '*' }
}]

Upvotes: 5

Related Questions