Code Monkey home page Code Monkey logo

pino-cloud-js's Introduction

@relaycorp/pino-cloud

This library generates Pino configuration to format log entries in such a way that they can be properly ingested by cloud logging services such as those on Google Cloud Platform (GCP).

At this point, only GCP's Cloud Logging and Error Reporting services are supported, but we'd welcome any PRs to support additional targets, such as Elastic Search or AWS CloudWatch Logs.

Install

Releases are automatically pushed to NPM. For example, to get the latest release, run:

npm install @relaycorp/pino-cloud

Usage

This library simply returns a configuration object for Pino, which you augment before passing to Pino. For example:

import { getPinoOptions } from '@relaycorp/pino-cloud';

const LOGGER = pino({
  ...getPinoOptions(process.ENV.LOGGING_TARGET, {
    name: 'your-app-name',
    version: '1.0.2',
  }),
  level: 'debug',
});

If the environment variable LOGGING_TARGET is unset, an empty object is returned.

Targets

gcp

error and fatal logs are augmented to include Error Reporting fields, like the name and version of your app.

Additionally, if the log contains an err field that is an instance of Error, its stack trace will be added to the field stack_trace -- Where Error Reporting expects to find it.

API documentation

The API documentation can be found on docs.relaycorp.tech.

Contributing

We love contributions! If you haven't contributed to a Relaycorp project before, please take a minute to read our guidelines first.

pino-cloud-js's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar gnarea avatar relaybot-admin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pino-cloud-js's Issues

The automated release is failing 🚨

🚨 The automated release from the main branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the main branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two Factor Authentication for your account, set its level to "Authorization only" in your account settings. semantic-release cannot publish with the default "
Authorization and writes" level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Update to Pino v7

Describe the problem

The lib still relies on Pino v6, and new typings are now included with the v7. The exports are a bit different, for instance import { LoggerOptions } from 'pino'; would become import { P } from 'pino'; and usage would be namespaced with P.LoggerOptions. This breaks the libs' typings and return type becomes any, which in turn breaks our app's typechecking.

Describe the solution you'd like

Update the library to support Pino v7 and drop DefinitelyTyped typings.

Describe alternatives you've considered

In the meantime, I've overrided the getPinoOptions typings with local types of my own, but it's obviously not great πŸ˜‰

The automated release is failing 🚨

🚨 The automated release from the main branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the main branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two Factor Authentication for your account, set its level to "Authorization only" in your account settings. semantic-release cannot publish with the default "
Authorization and writes" level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.