log icon indicating copy to clipboard operation
log copied to clipboard

Make `NopLogger` public

Open tommasoclini opened this issue 4 months ago • 5 comments

I think it would be nice to have a ready to use nop logger from the application side.

tommasoclini avatar Aug 30 '25 08:08 tommasoclini

The NopLogger is the same as not setting a logger, why would it need to be set?

Thomasdezeeuw avatar Aug 30 '25 08:08 Thomasdezeeuw

In some cases it can be helpful, for example when not using the default logger, but you want to turn off logging for a specific struct.

tommasoclini avatar Aug 30 '25 09:08 tommasoclini

How would that work? NopLogger doesn't do anything, it doesn't any thing for a "specific struct".

Thomasdezeeuw avatar Aug 30 '25 09:08 Thomasdezeeuw

I'll tell you my specific use case, I'm trying to add a logger to the ergot stack, instead of using the default one, and the logger would be a field of a struct. By default, the logger would be a &NopLogger, then the user can set a logger with a function set_logger. It would be nice to have a ready to use NopLogger instead of copying and pasting it.

tommasoclini avatar Aug 30 '25 09:08 tommasoclini

@KodrAus what do you think? I'm not quite convinced that not having to copy 10 lines of code, that basically do nothing, is enough of an argument to maintain the additional API.

Thomasdezeeuw avatar Sep 06 '25 11:09 Thomasdezeeuw