From 61e5d3e358a8147f9157a136d56da9e4e4bd0d45 Mon Sep 17 00:00:00 2001 From: Tom Adler Date: Wed, 3 Nov 2021 17:13:12 +0100 Subject: [PATCH] Bump pino version from 6.0.0 to 7.0.0 (#144) * Bump pino from 6.0.0 to 7.0.0 * remove Node 10, add Node 16 * remove hapi 18 and 19 * upgrade lab to pass tests on Node 16 * update README.md * get caller file? --- .github/workflows/test.yml | 9 ++------- README.md | 3 ++- index.js | 4 ++++ package.json | 5 +++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0fab713..ff8621b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,13 +15,8 @@ jobs: strategy: matrix: - node: [10, 12, 14] - hapi: ["@hapi/hapi@18", "@hapi/hapi@19", "@hapi/hapi@20"] - exclude: - - node: 10 - hapi: "@hapi/hapi@19" - - node: 10 - hapi: "@hapi/hapi@20" + node: [12, 14, 16] + hapi: ["@hapi/hapi@20"] steps: - uses: actions/checkout@v2 diff --git a/README.md b/README.md index c476198..5e508b0 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ post-processing. ## Supported Hapi versions -- hapi-pino v7.x and v8.x supports Hapi v18 and v19. +- hapi-pino v8.x supports Hapi v20. (Known to work on v18 and v19, not tested anymore.) +- 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 diff --git a/index.js b/index.js index c89cf17..8257c2b 100644 --- a/index.js +++ b/index.js @@ -5,6 +5,7 @@ const pino = require('pino') const { stdSerializers } = pino const serializersSym = Symbol.for('pino.serializers') const nullLogger = require('abstract-logging') +const getCallerFile = require('get-caller-file') const levelTags = { trace: 'trace', @@ -46,6 +47,9 @@ async function register (server, options) { logger[serializersSym].err = options.serializers.err } } else { + if (options.transport && !options.transport.caller) { + options.transport.caller = getCallerFile() + } options.stream = options.stream || process.stdout var stream = options.stream || process.stdout logger = pino(options, stream) diff --git a/package.json b/package.json index 53ab1bb..0079284 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "devDependencies": { "@hapi/code": "^8.0.0", "@hapi/hapi": "^20.0.0", - "@hapi/lab": "^23.0.0", + "@hapi/lab": "^24.3.2", "coveralls": "^3.0.11", "flush-write-stream": "^2.0.0", "make-promises-safe": "^5.1.0", @@ -32,7 +32,8 @@ "dependencies": { "@hapi/hoek": "^9.0.0", "abstract-logging": "^2.0.0", - "pino": "^6.0.0", + "get-caller-file": "^2.0.5", + "pino": "^7.0.0", "pino-pretty": "^4.0.0" }, "repository": {