Let callers provide a logger instead of the global B2_LOG_LEVEL debug output
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Start with internal/blog/blog.go to trace how B2_LOG_LEVEL and the global log writer are used, then read base/base.go around logRequest and logResponse and follow how client options reach base. Define how a per-client logger and code-set level fit that flow while preserving the environment fallback. Done means the acceptance criteria pass for one logger, two isolated clients, and the no-logger fallback.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
blazer's debug output can only be controlled through the environment. internal/blog reads B2_LOG_LEVEL once in init and writes through the process-wide log package. A library user cannot, from code, turn the output on or off, change its level, send it to their own logger (for example log/slog, a per-client sink or a test buffer), or filter it before it is written.
Current behavior
At a5e0d13:
- internal/blog/blog.go:33-40: the level comes from
B2_LOG_LEVELininit; there is no setter. - internal/blog/blog.go:50-60:
InfoandInfofwrite withlog.Print, after dropping CR and LF (added by Backblaze/blazer#170). - base/base.go:244-268 and :309-341:
logRequestandlogResponsewrite throughblog.V(2), including request and response bodies (with credential fields redacted) at level 2.
The only way for an application to capture or silence the output is to replace the global log writer, which also affects its own logging and every other library that uses log.
Expected behavior
Applications decide where blazer's debug output goes and at what level, per client, without relying on the process environment.
Proposed change
- Add a client option that takes a
*slog.Logger(available with the currentgo 1.26.10minimum) or afunc(level int, msg string), passed through tobaseso each client logs to its own sink. - Add an option to set the debug level from code.
- Keep
B2_LOG_LEVELand the globallogwriter (with the CR/LF stripping) as the fallback when no logger is set, and document that level 2 includes request and response bodies.
Acceptance criteria
- With a caller-provided logger and level 2 set from code, the logger receives the request and response messages and the global
logwriter receives none. - Two clients with different loggers in one process each receive only their own messages.
- With no logger set,
B2_LOG_LEVELbehaves as today.
Related
Backblaze/blazer#149 (closed) and Backblaze/blazer#142 (merged) changed what the verbose log contains by redacting credential fields. Backblaze/blazer#170 (merged) drops CR and LF from log messages, and Backblaze/blazer#160 (merged) hardened SSE-C logging. This issue is about where the output goes.
- Lingua principale
- Go
- Stelle
- 66
- Fork
- 18
- Merge medio
- 1g 10h
- PR unite (30g)
- 132
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Backblaze/blazer
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Bucket.Attrs never returns ReplicationConfig: replication configuration is write-onlyForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
test: skip the fuzz non-vacuity guard when replaying a single seedForse già presa @ffumero2003 l’ha presa 5 giorni fa. Apertatesting
Backblaze/blazer#330 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Backblaze/blazer
Issue simili
-
needs-triage typo
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
llm-d-incubation/llm-d-scaling-manager#122 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue severity: low tech-debt
Difficoltà 2/5 Mezza giornata Idoneità per principianti 75/100
TMHSDigital/subenum#329 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] Backend summarize min() / max() panics when a field has no numeric valuesForse già presa @weng5e l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
grafana/grafana-infinity-datasource#1832 ·
I maintainer di solito rispondono entro 1 giorno
-
tech-debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
GillMacedo/godebugdiff#13 ·