log: allow --vmodule to downgrade the log level

This commit is contained in:
Marius van der Wijden 2025-04-01 12:37:00 +02:00 committed by lightclient
parent 54f72c796f
commit 68d523ccdd

View file

@ -179,11 +179,6 @@ func (h *GlogHandler) WithGroup(name string) slog.Handler {
// Handle implements slog.Handler, filtering a log record through the global,
// local and backtrace filters, finally emitting it if either allow it through.
func (h *GlogHandler) Handle(_ context.Context, r slog.Record) error {
// If the global log level allows, fast track logging
if slog.Level(h.level.Load()) <= r.Level {
return h.origin.Handle(context.Background(), r)
}
// Check callsite cache for previously calculated log levels
h.lock.RLock()
lvl, ok := h.siteCache[r.PC]