Giter Club home page Giter Club logo

winston-transport-stackdriver-error-reporting-master's Introduction

Stackdriver Error Reporting transport for Winston logger

Build Status Code Climate Scrutinizer Code Quality NPM Version

Overview

This package is Winston logger transport that sends errors to Stackdriver Error Reporting service.

It's able to work in two modes:

  1. Logging to stdout compatible with Google Container Engine;
  2. Logging via an API with a help of @google-cloud/error-reporting library.

Usage and Configuration

Simply add this to your Winston transports array:

    winston.configure({
      transports: [
        new StackdriverErrorReporting(options),
      ],
    });

This transport supports 100% same configuration options as @google-cloud/error-reporting library, and uses API transport by default. The only additional option is options.level that controls minimal log entry level that should be sent to Stackdriver.

If you want to use stdout logging mode, all you need is to switch mode and set your serviceContext:

    winston.configure({
      transports: [
        new StackdriverErrorReporting({
          mode: 'console',
          serviceContext: {
            service: 'my service',
            version: '1.0.0'
          }
        }),
      ],
    });

How it works

When log entry reaches this transport, it will search meta object of log entry for objects that looks like errors (with stack property defined). After that, all errors will be delivered to Stackdriver Error Reporting service.

If meta.context property is defined, it will be attached to error as it's context. Please see Stackdriver Error Reporting documentation for details.

Alternatives

Official package @google-cloud/logging-winston exists now, a winston transport for Stackdriver Logging, which can automatically report logged errors to Error Reporting.

winston-transport-stackdriver-error-reporting-master's People

Contributors

amd-boy-no-ne-tvoi avatar

Watchers

 avatar

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.