@ert78gb/pino-google-cloud-run-options
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

pino Google Cloud Run options

The package contains default configuration of the pino logger in the Google Cloud Run.

Google Cloud Run collects the logs from the standard output and standard error. If 1 log line is a valid json then the log aggregator parse it as a json and extract/move the severity and message properties to relevant p the LogEntry.

Pino has 6 log level by default. The Google Log has 9. The following table contains the mapping

pino Google Log
trace DEBUG
debug DEBUG
info INFO
warn WARNING
error ERROR
fatal CRITICAL

The custom log levels map to the DEFAULT Google Log level if you don't write custom formatter.

It does not log the hostname and pid information, because Google Cloud Run logs the instance id and other context information.

import pinoOptions from '@ert78gb/pino-google-cloud-run-options'
import pino from 'pino'

const logger = pino(pinoOptions)
// or extend
const logger = pino({
  ...pinoOptions,
  level: process.env.LOG_LEVEL
})

/@ert78gb/pino-google-cloud-run-options/

    Package Sidebar

    Install

    npm i @ert78gb/pino-google-cloud-run-options

    Weekly Downloads

    398

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    2.9 kB

    Total Files

    4

    Last publish

    Collaborators

    • ert78gb