ogmios
ogmios copied to clipboard
client/TypeScript: Abstract Logging
Describe your idea, in simple words.
I have a bunch of generic logging at the application level of my current project that best belongs upstream. I would like to hoist the abstract calls and refactor the clients to accept a logger instance compatible with console
or bunyan.
- The abstract logger ts-log would be the added dependency
- Default operation is silent.
Why is it a good idea?
To increase the value of the clients with consistent logging behaviour across implementations. It's valuable for both development and production as an opt-in feature.
Are you willing to work on it yourself?
Yes
Thoughts @KtorZ?
@rhyslbw would it make to approach this from the angle of an event stream or even, a (writable) stream itself? It doesn't really solve the question of the structure of the logging itself, and for that, I agree that sticking to structure from widely used / battle-tested logging libraries like Bunyan definitely make sense.
I'd imagine that a client could merely be an event emitter to which an upstream application can subscribe and log things the way it suits it.
I'm not against using an alternative approach, but to me the abstract logger is a nice familiar interface that expresses the behaviour of a logger, and was designed for this exact use-case. It can be satisfied with any implementation, not limited to console
or bunyan
, however the latter is a powerful solution with stream-based features: https://www.npmjs.com/package/bunyan#streams