1.0.0 • Published 5 years ago
sievel v1.0.0
SIEVEL
Make app objects consumable by loggers and reporters
WIP
Not yet ready.
Why?
I want to have separate routines for logging and reporting, well-integrated with execution environment.
Logging:
console.log (...format`${this} just launched`);
Logging and reporting:
console.log (...report`${this} just launched`);
Just reporting:
report`${this} just launched`;
Result? Browser will have proper caller and stringified message with browsable object, reporter will have human–readable and machine–readable log messages.
Usage
// use with defaults
import {format, report} from 'sievel';
console.log (...report`${this} just launched`);
// customize
import sievel from 'sievel';
// verbose setting once per app, also supports env vars
sievel.mute ('Loader');
sievel.only ('Loader');
Environments
Browser
Just works for any modern browser.
node.js
Not released yet.
Features
No one can tell what should be reported. List safe fields and avoid any sensitive data leak. Skip extra fields to reduce bandwith.
- Logging object should describe it's own stringified version with
toString()
and report fields withtoJSON()
; - Formatting and reporting configurable per object (but please use class instances);
- You can turn off logging per class by class name;
1.0.0
5 years ago