GithubHelp home page GithubHelp logo

loganbfisher / yodelay Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 1.03 MB

Yodelay was made to combine the ability of logging and shipping uncaught exceptions and error metrics off via api request in a simple json structure.

JavaScript 18.73% CSS 8.73% HTML 72.53%
logging prometheus metrics uncaught-exceptions errors logger winston-logger

yodelay's Introduction

Yodelay

Yodelay was made to combine the ability of logging and shipping uncaught exceptions and error metrics off via api request in a simple json structure. I am using this for gathering and alerting errors and uncaught errors in our applications and shipping them off to a microservice that builds out metrics for prometheus to scrape.

Out of the box it is set to format your logs with either simple or json formatting. You can also select what log level you would like to use. The simple format adds prettyness to your logs while both simple and json adds a couple more fields that are helpful for log aggregators like kibana or loggly.

Install

npm install yodelay --save

Example

import Yodelay from "yodelay";

const logger = new Yodelay({
  metricsEndpoint: 'https://example.example.com/metrics',
  appName: "prod-example-api",
  level: process.env.LOG_LEVEL,
  format: process.env.LOG_FORMAT
});

logger.info('This is an info log...');
logger.error('This is an info log...');
logger.debug('This is an info log...');
Param Description Type Required Options Example Default
metricsEndpoint Api url or your metrics scraper String false
level Log level String false (inherited from winston) info
format Log format String false simple, json json
appName Name of application your logging String true
debugContext Context for the current section of code being logged out. String false logger.info('This is a log', this.data, 'test-context')

Metrics Message Format

{
  metricAppName: 'test-app',
  errorType: 'uncaught_exception',
  message: 'Something bad happened on line...'
}

Debug Context

It is important to note that debug context is use to filter out logs you arent interested in while debugging. It could be a certain if statement or a whole application, that part is totally up to you. You can still pass in context even if you dont havea debugContext enabled. This helps when looking at logs to know where the log came from easier.

yodelay's People

Contributors

loganbfisher avatar

Watchers

 avatar  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.