Almost every logger in java operates this way. You set your library logging to debug and the end user and configure if they want debug logs from your library or not. They can even set context variables.
Python too. Honestly, any mature logger should allow embedding logs in library code that can be turned on or off by the end user. This was a solved problem 20 years ago. I honestly don't see what's so novel about this today. Or is this speaking to the sorry state of software engineering that plagues the JavaScript world?
I really want something like this to be built into the language or runtime, I don't want to juggle configuration for 4 different libraries. Log4j and tracing seem to be well established without being built in, but it feels too late for js.
I’ve been pretty happy with logtape which is specifically designed to be used in libraries as well as apps: https://logtape.org/manual/library
Almost every logger in java operates this way. You set your library logging to debug and the end user and configure if they want debug logs from your library or not. They can even set context variables.
Python too. Honestly, any mature logger should allow embedding logs in library code that can be turned on or off by the end user. This was a solved problem 20 years ago. I honestly don't see what's so novel about this today. Or is this speaking to the sorry state of software engineering that plagues the JavaScript world?
This feels a bit like a pub/sub pattern; I wonder what it would look like with a full pub/sub implementation.
industry-proven and mature libs like LOG4J or LOG4Net are not sufficient?
You mean this log4j [0] with major vulnerabilities the industry missed for nearly a decade?
[0] https://en.wikipedia.org/wiki/Log4Shell
So you don’t use any software that has had a security vulnerability?
What operating system and browser did you use to write your post?
Have you used ever OpenSSL? :-D
The thing is: A bug does not invalidate enterprise adoption - Microsoft ist a good example.
2 replies →
At least you learned something
Wasn't OpenTelemetry invented for this purpose?
I really want something like this to be built into the language or runtime, I don't want to juggle configuration for 4 different libraries. Log4j and tracing seem to be well established without being built in, but it feels too late for js.
I'm curious if this is enough https://nodejs.org/api/diagnostics_channel.html
I don't like the js hotel libraries, their docs feel deliberately obtuse
Did you consider log4js?