hapijs / hapijs/hapi-pino

Unable to log a "request" event while using "response.failaction" settings as "log" instead of throwing an error.

Open
#80 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
147
Forks
56
PR merge metrics
No merged PRs in 30d

Description

Hapi allows you to choose what to do when response validation fails by setting response.failAction. (ref.: https://hapijs.com/tutorials/validation#failaction)

When we set that option to:

![image](https://user-images.githubusercontent.com/501994/60847406-6fd6ea00-a197-11e9-800c-c273fa135b37.png)

the current way that `hapi-pino` is set to log requests which have the `event.channel` set to `internal` doesn't recognizes that configuration and the log message is ignored.

This is where Hapi check for the response.failAction settings
**_node_modules/@hapi/hapi/lib/toolkit.js_**
![image](https://user-images.githubusercontent.com/501994/60847497-a876c380-a197-11e9-8d28-106e79361f2b.png)

This is where Hapi creates a log payload using the internal channel
**_node_modules/@hapi/hapi/lib/request.js_**
![image](https://user-images.githubusercontent.com/501994/60847606-1327ff00-a198-11e9-9ee4-1a4ae10bcd7c.png)

This is where `hapi-pino` is ignoring the log message:
**_node_modules/hapi-pino/index.js_**
![image](https://user-images.githubusercontent.com/501994/60847559-e378f700-a197-11e9-9c9a-5af5257ad5c9.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.