2.1.14 • Published 4 years ago

yodelay v2.1.14

Weekly downloads
107
License
ISC
Repository
github
Last release
4 years ago

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...');
ParamDescriptionTypeRequiredOptionsExampleDefault
metricsEndpointApi url or your metrics scraperStringfalse
levelLog levelStringfalse(inherited from winston)info
formatLog formatStringfalsesimple, jsonjson
appNameName of application your loggingStringtruetrue
debugContextContext for the current section of code being logged out.Stringfalselogger.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.

2.1.14

4 years ago

2.1.13

5 years ago

2.1.1

5 years ago

2.0.13

5 years ago

2.0.12

5 years ago

2.1.0

6 years ago

2.0.11

6 years ago

2.0.10

6 years ago

2.0.9

6 years ago

2.0.8

6 years ago

2.0.7

6 years ago

2.0.6

6 years ago

2.0.5

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago