2.5.0 • Published 4 years ago

connor-base-log v2.5.0

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

CircleCI Libraries.io dependency status for GitHub repo GitHub release Dependent repos (via libraries.io)

Connor's Base Log Package

I tend to use this boilerplate package for logging. It automatically sets up Sentry logging and some nice sane defaults for logging with or without a TTY. Designed for use with my default config library.

Install

npm install connor-base-log

How to use

//Assuming you have a config.js boilerplate from my logging lib
//index.js
const config = require('./config'); //This config.js should contain your basic config overwrites like sentry etc.
const log = require('connor-base-log'); 

log.silly("You may as well just print out every tick", {counter: counter});
log.debug("Okay but you still won't be able to read this");
log.verbose("Eh, this is acceptable in production", {customer_bank_account_no: key});
log.info("A descriptive info which will come up as a breadcrumb on Sentry", {with: extraData});
log.warn("Hm, did you mean to do that? This will show up in Sentry as a warning.", {you: screwedup});
log.error("We're going to spam Sentry with this error");
//Protip: You can set the environment variable LOG_LEVEL to change what shows up in your console.

//config.js
const config = require('connor-base-config');
config.load({sentry: {enabled: true, dsn: "https://sentry.makeshift.ninja/"}});
module.exports = config;

Lazy Template

const config = require('connor-base-config');
config.load({sentry: {enabled: true, dsn: "https://sentry.makeshift.ninja/"}});
const log = require('connor-base-log');

Changing defaults

You can change the options by either:

  • Overriding them in config.js
  • Requiring connor-base-config and overwriting with .load in-script
  • Setting environment variables, you can see a full list in the schema
2.5.0

4 years ago

2.4.3

4 years ago

2.4.2

4 years ago

2.4.1

4 years ago

2.4.0

4 years ago

2.3.1

4 years ago

2.3.0

4 years ago

2.2.0

4 years ago

2.1.0

4 years ago

2.0.8

5 years ago

2.0.7

5 years ago

2.0.6

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago