Remove or filter weaver log levels

Aperta
#262 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@Sukuna0007Abhi ci sta già lavorando.

Dal 22/1/2026.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
scala
Ambito
testing

Direzione di ricerca

Inizia tracciando i metodi di weaver.Log e il modo in cui chiamano sbt.testing.Logger. Confronta la rimozione dei livelli di weaver con la loro traduzione nei livelli SBT, quindi conferma che il comportamento scelto supporti un output comprensibile e il filtraggio per livello di log senza mostrare livelli duplicati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

The weaver.Log logger currently supports levels via different methods for info, warn, error and debug.

The log level is prepended to the message and then logged using the sbt.testing.Logger using the logger.error method.

This means that two levels are displayed in the console output: the SBT error, and then the weaver log level.

Image

It's not possible to filter the logs using specific levels. On test failure, all the logs are displayed.

We could make logs easier to understand by one of two approaches:

  • removing log levels
  • logging using the sbt.testing.Logger levels

Removing log levels

Given no issues have been raised for log filtering yet, this aspect of the weaver logger is not likely to be used. We could remove levels entirely, and deprecate the log.info and log.error methods in favour of a single log(...) method.

The printed logs would then look like:

[error]     14:38:01 [HashingSpec.scala:36] An info log
[error]     14:38:01 [HashingSpec.scala:37] A debug log
[error]     14:38:01 [HashingSpec.scala:38] An error log

Users could always add the levels in their own code to get the current behaviour:

def logInfo(msg: String): IO[Unit] = log(s"[INFO] $msg")

Logging using the sbt.testing.Logger levels

The weaver log levels could be translated to SBT log levels. This would be more complex to support, but would enable filtering via SBT's logLevel setting.

The logs would then look like:

[info]    14:38:01 [HashingSpec.scala:36] An info log
[debug]   14:38:01 [HashingSpec.scala:37] A debug log
[error]   14:38:01 [HashingSpec.scala:38] An error log
Lingua principale
Scala
Stelle
87
Fork
17
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di typelevel/weaver-test

Tutte le issue di typelevel/weaver-test

Issue simili

Altre issue su Scala

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.