-
Notifications
You must be signed in to change notification settings - Fork 80
Open
Description
Following discussion in #234 I propose a very simple customizable (error) logging. Instead of hard coding console.error(err), define the global logging API with the default implementation, e.g.
const dstoreLog = {
exception(err) { console.error(err); }
// ... other functions
}then exchange all console.error(err) for dstoreLog.exception(err). Everything work backward compatible. But a library user may easily plug in own handler, e.g.
dstoreLog.exception = (err) => {
// some custom code for error reporting
}And that's all, very simple and no external dependencies.
Note: I have not a big experience with JS, but this pattern is used in C# libraries very often.
Metadata
Metadata
Assignees
Labels
No labels