Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ert78gb/pino-google-cloud-run-options
Configuration of pino for Google Cloud Run
https://github.com/ert78gb/pino-google-cloud-run-options
Last synced: 13 days ago
JSON representation
Configuration of pino for Google Cloud Run
- Host: GitHub
- URL: https://github.com/ert78gb/pino-google-cloud-run-options
- Owner: ert78gb
- Created: 2022-06-20T22:22:53.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-10-07T14:16:02.000Z (3 months ago)
- Last Synced: 2024-11-28T22:42:06.357Z (25 days ago)
- Language: JavaScript
- Size: 48.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# pino Google Cloud Run options
The package contains default configuration of the [pino](https://github.com/pinojs/pino) logger in the
Google [Cloud Run](https://cloud.google.com/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](https://cloud.google.com/logging/docs/reference/v2/rest/v2/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.```javascript
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
})
```