alt.hn

12/12/2025 at 3:46:44 PM

I couldn't find a logging library that worked for my library, so I made one

https://hackers.pub/@hongminhee/2025/logtape-fedify-case-study

by todsacerdoti

12/12/2025 at 11:41:58 PM

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.

by malfist

12/13/2025 at 3:18:07 PM

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?

by throwaway150

12/13/2025 at 11:32:23 PM

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

by callumgare

12/12/2025 at 11:49:25 PM

This feels a bit like a pub/sub pattern; I wonder what it would look like with a full pub/sub implementation.

by cowlby

12/13/2025 at 7:27:56 AM

industry-proven and mature libs like LOG4J or LOG4Net are not sufficient?

by KellyCriterion

12/13/2025 at 2:14:05 PM

You mean this log4j [0] with major vulnerabilities the industry missed for nearly a decade?

[0] https://en.wikipedia.org/wiki/Log4Shell

by hansvm

12/13/2025 at 3:00:03 PM

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?

by mashepp

12/13/2025 at 3:06:18 PM

Have you used ever OpenSSL? :-D

The thing is: A bug does not invalidate enterprise adoption - Microsoft ist a good example.

by KellyCriterion

12/13/2025 at 3:34:15 PM

That was less my point, and more that "battle-tested" doesn't have to be a cudgel to argue against in-house projects, especially when considering defect rates (the more-general solution is very often slower and buggier to support the features you don't need).

by hansvm

12/13/2025 at 4:00:09 PM

Maybe we should differ the terms:

"industry proven" -> MS/Windows -> yes

"battle tested" -> MS Windows -> you may discuss? :-D

If there is an inhouse solution available and which is really working, then Id not introduce an externa component here. If you start from zero, then using a pre-existing component should be the path, in my perception. Sure, one can waste time write a logger, but should have e.g. Bezos spent time coding on a logging lib or care about the webshop and use an existing lib for that - but in most cases it does not payoff to do whatever self-implementation-voodoo someone imagines: its just a waste of time. (Esp. since most companies do not take off enough to make such an investment plausible)

by KellyCriterion

12/13/2025 at 12:11:17 AM

At least you learned something

by reactordev

12/12/2025 at 11:44:28 PM

Wasn't OpenTelemetry invented for this purpose?

by bgoosman

12/13/2025 at 1:28:03 AM

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

by seniorsassycat

12/13/2025 at 12:43:41 AM

Did you consider log4js?

by drdec