Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vikramtiwari/asynclog
logging made easy, useful and scalable
https://github.com/vikramtiwari/asynclog
colors easy-to-use error-reporting event-tracking google-cloud logging nodejs stacktrace
Last synced: 14 days ago
JSON representation
logging made easy, useful and scalable
- Host: GitHub
- URL: https://github.com/vikramtiwari/asynclog
- Owner: VikramTiwari
- License: gpl-3.0
- Created: 2017-05-13T05:40:26.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-05-11T17:25:39.000Z (over 4 years ago)
- Last Synced: 2024-11-06T08:18:29.388Z (2 months ago)
- Topics: colors, easy-to-use, error-reporting, event-tracking, google-cloud, logging, nodejs, stacktrace
- Language: JavaScript
- Homepage:
- Size: 2.86 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# asynclog
Logging made easy, useful and scalable
[![Build Status](https://travis-ci.org/VikramTiwari/asynclog.svg?branch=master)](https://travis-ci.org/VikramTiwari/asynclog) [![NPM Version](https://img.shields.io/npm/v/asynclog.svg)](https://www.npmjs.com/package/asynclog) [![NPM Download](https://img.shields.io/npm/dm/asynclog.svg)](https://www.npmjs.com/package/asynclog) [![Greenkeeper badge](https://badges.greenkeeper.io/VikramTiwari/asynclog.svg)](https://greenkeeper.io/)
## Features
- Easy to use
- External transport
- Event tracking## How to use
- Include package in your project
``` sh
npm install --save asynclog
# or, if you are using yarn
yarn add asynclog
```- Start using
``` javascript
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
``` bash
ASYNCLOG_NAMESPACE=* node example.js
```[Logs Image]
## External log providers
- Google Cloud
``` bash
# Set ENV variables before running project
LOG_TRANSPORT=google-cloud
GCLOUD_PROJECT=ivikramtiwari # use your project id
```## Event Tracking
- Google Analytics
``` bash
# Set ENV variables before running project
EVENT_TRACKING=google-analytics
GA_TRACKING_ID=UA-20640332-8 # use your tracking id
```## Error Reporting
- Google Cloud - Stackdriver Error Reporting
``` bash
# Set ENV variables before running project
ERROR_TRANSPORT=google-cloud
ERROR_TRANSPORT_CONFIG={"projectId":"ivikramtiwari","ignoreEnvironmentCheck":false,"logLevel":2} # replace with your own config
```## Environment Variables
| ENV Variable | Possible Value | Usage |
|------|----------------|-------|
| ASYNCLOG_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 | 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 |
| ERROR_TRANSPORT | `google-cloud` | stream errors to google cloud's stackdriver error logging |
| ERROR_TRANSPORT_CONFIG | `{"projectId":"ivikramtiwari","ignoreEnvironmentCheck":false,"logLevel":2}` | required if `google-cloud` was selected as ERROR_TRANSPORT |## Credits
### Developer: [👨💻 Vikram Tiwari](https://vikramtiwari.com)
If you found this library helpful, or learned something from it and want to thank me, consider [buying me a cup of ☕️.](https://www.paypal.me/vikramtiwari/5)