https://github.com/andrejewski/stash-logger
Buffered logger with customizable log levels
https://github.com/andrejewski/stash-logger
Last synced: 9 months ago
JSON representation
Buffered logger with customizable log levels
- Host: GitHub
- URL: https://github.com/andrejewski/stash-logger
- Owner: andrejewski
- License: isc
- Created: 2016-08-03T20:40:37.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-08-05T22:50:40.000Z (over 9 years ago)
- Last Synced: 2025-04-22T08:56:20.006Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 10.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Stash Logger
```sh
npm install stash-logger
```
```js
import StashLogger from 'stash-logger';
const myLogger = new StashLogger({
endpoint: '/my/logs/go/here',
appId: 'my-awesome-app'
});
myLogger.attach();
// sets the buffer write interval
// adds error listeners to window/process globals appropriately
myLogger.error('Bad stuff happened');
// ^ adds to the buffer which will group messages to send off
myLogger.errorImmediately('Really bad stuff happened');
// ^ sends this log off without waiting in the buffer
myLogger.detach();
// clears the buffer write interval
// removes error listeners from window/process
```