JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q23226F
  • License GPL-3.0

logging made easy, useful and scalable

Package Exports

  • asynclog

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (asynclog) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

asynclog

Logging made easy, useful and scalable

Build Status NPM Version NPM Download Greenkeeper badge

Features

  • Easy to use
  • External transport
  • Event tracking

How to use

  • Include package in your project
npm install --save asynclog
# or, if you are using yarn
yarn add asynclog
  • Start using
const log = require('asynclog')('myApp')

function hello () {
  log('Logging made', 'easy,', 'useful', 'and scalable.')
  log.warn('Not all problems are solved.')
  log.info('And we are actively working to solve them.')
  log.error('Issues:', 'https://github.com/VikramTiwari/asynclog/issues')
  log.trace('Include stacktraces, they make it easier to debug.')
  log.event(0, 'Category', 'Action', 'Label', 0)
}

hello()
  • Enable logging namespace while running program
LOG_NAMESPACE=* node example.js

[Logs Image]

External log providers

  • Google Cloud
# Set ENV variables before running project
LOG_TRANSPORT=google-cloud
GCLOUD_PROJECT_ID=ivikramtiwari # use your project id

Event Tracking

  • Google Analytics
# Set ENV variables before running project
EVENT_TRACKING=google-analytics
GA_TRACKING_ID=UA-20640332-8 # use your tracking id

Environment Variables

ENV Variable Possible Value Usage
LOG_NAMESPACE * see all logs
myNamespace log for myNamespace
-myNamespace don't log myNamespace
LOG_TRANSPORT google-cloud stream logs to google cloud logging
GCLOUD_PROJECT_ID your-project-id required if google-cloud was selected as LGO_TRANSPORT
EVENT_TRACKING google-analytics stream event to google analytics
GA_TRACKING_ID UA-12345678-9 required if google-analytics was selected as EVENT_TRACKING

Credits

Developer: 👨‍💻 Vikram Tiwari

If you found this library helpful, or learned something from it and want to thank me, consider buying me a cup of ☕️.