All Projects → wework → we-js-logger

wework / we-js-logger

Licence: MIT license
Universal logger with transports to Rollbar and Logentries. Uses bunyan under the hood.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to we-js-logger

Reactrenderer
Client and Server-side React rendering from PHP
Stars: ✭ 201 (+1335.71%)
Mutual labels:  universal
Universal React
A universal react starter, with routing, meta, title, and data features
Stars: ✭ 247 (+1664.29%)
Mutual labels:  universal
makeuniversal
Tool to create a Universal Binary version of a Qt distribution.
Stars: ✭ 40 (+185.71%)
Mutual labels:  universal
Expo
An open-source platform for making universal native apps with React. Expo runs on Android, iOS, and the web.
Stars: ✭ 15,550 (+110971.43%)
Mutual labels:  universal
Angular Awesome List
Список ресурсов по Angular на русском
Stars: ✭ 224 (+1500%)
Mutual labels:  universal
Beidou
🌌 Isomorphic framework for server-rendered React apps
Stars: ✭ 2,726 (+19371.43%)
Mutual labels:  universal
Judo Heroes 2
Universal Javascript sample application with React Router 4 and Express 5 (Enhanced version of https://github.com/lmammino/judo-heroes)
Stars: ✭ 182 (+1200%)
Mutual labels:  universal
CorePartition
Universal Cooperative Multithread Lib with real time Scheduler that was designed to work, virtually, into any modern micro controller or Microchip and, also, for user space applications for modern OS (Mac, Linux, Windows) or on FreeRTOS as well. Supports C and C++
Stars: ✭ 18 (+28.57%)
Mutual labels:  universal
Xamarinuniversallibrary
This is a universal library that contains everything we need to know about the Xamarin universe. This is an open-source project from the community to the community.
Stars: ✭ 235 (+1578.57%)
Mutual labels:  universal
koa-webpack-server
Koa2 webpack all-in-one environment for universal development
Stars: ✭ 14 (+0%)
Mutual labels:  universal
Gl React
gl-react – React library to write and compose WebGL shaders
Stars: ✭ 2,536 (+18014.29%)
Mutual labels:  universal
Firebase Functions Next Example
Host a Next.js SSR React app on Cloud Functions for Firebase with Firebase Hosting
Stars: ✭ 215 (+1435.71%)
Mutual labels:  universal
React Isomorphic Video Game Search
An Isomorphic application demo powered by React, reflux, react-router-component, express, superagent and the Giant Bomb API.
Stars: ✭ 253 (+1707.14%)
Mutual labels:  universal
Next Routes
Universal dynamic routes for Next.js
Stars: ✭ 2,354 (+16714.29%)
Mutual labels:  universal
antonybudianto-web-old
Personal website
Stars: ✭ 14 (+0%)
Mutual labels:  universal
Celestite
Beautifully reactive, server-side rendered Svelte apps w/ a Crystal backend
Stars: ✭ 185 (+1221.43%)
Mutual labels:  universal
Arc
React starter kit based on Atomic Design
Stars: ✭ 2,780 (+19757.14%)
Mutual labels:  universal
grand central
State-management and action-dispatching for Ruby apps
Stars: ✭ 20 (+42.86%)
Mutual labels:  universal
react-universal-app
Library for building a single-page application with Universal React component(s) and React Router.
Stars: ✭ 14 (+0%)
Mutual labels:  universal
Next.js
The React Framework
Stars: ✭ 78,384 (+559785.71%)
Mutual labels:  universal

we-js-logger

Build Status Coverage Status NPM version NPM downloads MIT License

Sauce Test Status

Logger for node processes and browser applications with transports to Rollbar and Logentries

Introduction

This is an opinionated logger for JS applications:

  • Uses bunyan, a JSON logger, under the hood
  • Transports logs to Logentries and/or Rollbar
  • Universal. Can be used in the browser and Node.js processes

Usage

import Logger from 'we-js-logger';
const log = new Logger({
    name: 'my-logger',
    environment: 'production',
    level: 'debug',
    codeVersion: process.env.SHA_VERSION,
    logentriesToken: process.env.LOGENTRIES_TOKEN,
    rollbarToken: process.env.ROLLBAR_TOKEN,
    scrubFields: ['password'], // blacklist field keys being sent through logger
});

Node.js usage

This package can be used via npm and node with no special considerations.

Browser usage

This package exposes a client build for browser usage. It is referenced in the browser field of package.json, so module loaders that follow this spec will load it easily.

For example, we commonly use webpack to load this module.

Webpack Considerations

TODO document webpack setup

Configuration

See https://github.com/wework/we-js-logger/blob/master/API.md#we-js-loggerutillogger for API documentation

Examples

log.fatal({ err }, 'Application crashing because something terrible happened.');

log.error({ err, req }, 'API request failed');

log.info({ action }, 'Something relevant happened')

log.debug({ event, action }, 'Something useful for developers happened');

See https://github.com/trentm/node-bunyan#log-method-api for more detail.

Logentries Integration

More docs coming soon.

Providing the Logger constructor a logentriesToken option enables this transport.

Rollbar Integration

Node

This library will initialize Rollbar See https://rollbar.com/docs/notifier/rollbar.js/#quick-start-server for documentation on setting up Rollbar for node processes.

Browser

For browser usage, this library expects Rollbar to be loaded via their quick-start script tag. This also allows Rollbar to capture any errors before the logger's initialization code, if that's important to you.

See https://rollbar.com/docs/notifier/rollbar.js/#quick-start-browser for documentation on setting up Rollbar for browser applications

Development

In lieu of a formal style guide, please ensure PRs follow the conventions present, and have been properly linted and tested. Feel free to open issues to discuss.

Be aware this module is tested in both browser and node runtimes.

Available tasks

Build and test

Runs all tests, static analysis, and bundle for distribution

$ npm start

Test

Runs browser and node tests

$ npm test

Runs browser tests via PhantomJS only

$ npm run test:browser

Runs browser tests via SauceLabs only

$ SAUCELABS=true npm run test:browser

Runs node tests only

$ npm run test:node

TDD

Runs browser and node tests in watch mode, re-bundles on src file change

$ npm run tdd

Docs

Regenerate API.md docs from JSDoc comments

$ npm run docs

Bundle

Packages client and node bundles for distribution, output to /dist

$ npm run bundle

Distribute

Lints, cleans, bundles, and generates docs for distribution, output to /dist

$ npm run dist

Release

We're using np to simplify publishing to git + npm. A changelog and docs are generated as part of this script.

$ npm run release <semver level/version>
$ npm run release patch # patch release
$ npm run release 100.10.1 # release specific version
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].