Skip to content

Commit

Permalink
Merge branch 'master' of github.com:pinojs/hapi-pino
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollina committed Mar 3, 2023
2 parents 7f79d2d + 7e162ff commit e1f1d62
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
node: [14, 16, 18]
hapi: ["@hapi/hapi@20"]
hapi: ["@hapi/hapi@21"]

steps:
- uses: actions/checkout@v2
Expand Down
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@
[Hapi](http://hapijs.com) plugin for the [Pino](https://github.com/pinojs/pino) logger. It logs in JSON for easy
post-processing.

## Supported Hapi versions

- hapi-pino v9.x supports Hapi v20.
- hapi-pino v8.x supports Hapi v18, v19 and v20.
- hapi-pino v7.x supports Hapi v18 and v19.
- hapi-pino v6.x supports Hapi v17, v18 and v19
- hapi-pino v5.x supports Hapi v17 and v18
- hapi-pino v3.x
supports Hapi v17 only. The maximum version that can be used with Hapi v16 is Pino v4.
- [hapi-pino v2.x](https://github.com/pinojs/hapi-pino/tree/v2.x.x) is the LTS line for Hapi v16.
## Hapi and Pino versions supported by hapi-pino

| hapi-pino | hapi | pino |
| ------------- |:--------------|:--------------|
| v12.x | v21 | v8 |
| v11.x | v20 | v8 |
| v9.x - v10.x | v20 | v7 |
| v8.x | v18, v19, v20 | v6 |
| v6.x | v17, v18, v19 | v5 |
| v5.x | v17, v18 | v5 |
| v3.x - v4.x | v17 | v4 |
| v2.x | v16 | v4 |

## Install

Expand Down Expand Up @@ -54,7 +56,6 @@ async function start () {
await server.register({
plugin: require('hapi-pino'),
options: {
prettyPrint: process.env.NODE_ENV !== 'production',
// Redact Authorization headers, see https://getpino.io/#/docs/redaction
redact: ['req.headers.authorization']
}
Expand Down
14 changes: 7 additions & 7 deletions index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Request, Server } from '@hapi/hapi';
import { Request, Server, server, ServerApplicationState } from '@hapi/hapi';
import pino from 'pino';
import * as HapiPino from '.';
import { expectType } from 'tsd';

const pinoLogger = pino();

const server = new Server();
const hapiServer = server();

const options: HapiPino.Options = {
timestamp: () => `,"time":"${new Date(Date.now()).toISOString()}"`,
Expand Down Expand Up @@ -46,15 +46,15 @@ const options: HapiPino.Options = {
ignoredEventTags: [{ log: ['DEBUG', 'TEST'], request: ['DEBUG', 'TEST'] }],
};

expectType<Promise<void>>(server.register({ plugin: HapiPino, options }));
expectType<Promise<Server<ServerApplicationState> & void>>(hapiServer.register({ plugin: HapiPino, options }));

const emptyOptions: HapiPino.Options = {};
expectType<Promise<void>>(server.register({ plugin: HapiPino, options: emptyOptions }));
expectType<Promise<Server<ServerApplicationState> & void>>(hapiServer.register({ plugin: HapiPino, options: emptyOptions }));

server.logger.info('some message');
server.logger.error(new Error('some error'));
hapiServer.logger.info('some message');
hapiServer.logger.error(new Error('some error'));

server.route({
hapiServer.route({
method: 'GET',
path: '/path',
handler(request) {
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@
"license": "MIT",
"devDependencies": {
"@hapi/code": "^9.0.0",
"@hapi/hapi": "^20.2.1",
"@hapi/hapi": "^21.0.0",
"@hapi/lab": "^25.0.0",
"@types/node": "^18.0.0",
"coveralls": "^3.1.1",
"flush-write-stream": "^2.0.0",
"make-promises-safe": "^5.1.0",
"pino-pretty": "^7.6.1",
"pino-pretty": "^9.0.0",
"pre-commit": "^1.2.2",
"split2": "^4.1.0",
"standard": "^17.0.0",
"tsd": "^0.20.0"
},
"dependencies": {
"@hapi/hoek": "^10.0.0",
"@types/hapi__hapi": "^20.0.10",
"@hapi/hoek": "^11.0.0",
"abstract-logging": "^2.0.1",
"get-caller-file": "^2.0.5",
"pino": "^8.5.0"
Expand Down

0 comments on commit e1f1d62

Please sign in to comment.