Serilog sink: add `MinimumLogLevel` to filter logs separately from events and breadcrumbs
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 48/100
Línea de trabajo
Read SentrySink.InnerEmit alongside NLog's SentryTarget.InnerWrite (#5913) to see where the log-level check belongs, then look at SentrySerilogOptions and the WriteTo.Sentry(...) overload that already exposes minimumEventLevel and minimumBreadcrumbLevel. The open questions — how to express "off" with LogEventLevel and which default keeps 7.0 behaviour — should be settled on the thread before writing code, since they shape the option's type and the Serilog.Settings.Configuration binding. Done means the sink options, the WriteTo.Sentry argument and the sink's filtering are in place, with tests covering each level combination from the table in the issue.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem Statement
Since 7.0.0, the Serilog sink sends every entry it receives to Sentry as a log. Serilog's restrictedToMinimumLevel and levelSwitch decide which entries reach the sink, so raising them also cuts events and breadcrumbs. The sink has MinimumEventLevel and MinimumBreadcrumbLevel, but no level for logs.
Measured against 7.0.1, writing one info, one warning and one error:
| Sink setup | Logs | Breadcrumbs | Events |
|---|---|---|---|
| default | 3 | 3 | 1 |
restrictedToMinimumLevel: Error |
1 | 1 | 1 |
restrictedToMinimumLevel: Fatal |
0 | 0 | 0 |
An app that uses the sink for errors and breadcrumbs, and doesn't want Sentry Logs, can only use SetBeforeSendLog. To leave SentrySdk.Logger alone, the callback has to match on the sink's origin:
options.SetBeforeSendLog(log =>
log.TryGetAttribute("sentry.origin", out var origin) && origin is "auto.log.serilog" ? null : log);
That builds each log before dropping it, counts it as discarded in client reports, and can't be set from Serilog.Settings.Configuration.
The other logging integrations already have a switch for logs alone:
- NLog:
MinimumLogLevel, which can beOff(#5913). That PR noted that Serilog has no threshold for logs. Logging.AddSentry(): theSentryprovider alias,Logging:Sentry:LogLevel:Default = None(#5988, getsentry/sentry-docs#20947).
Solution Brainstorm
Add MinimumLogLevel to SentrySerilogOptions, and a minimumLogLevel argument to WriteTo.Sentry(...) next to minimumEventLevel and minimumBreadcrumbLevel, so it binds from appsettings.json. SentrySink.InnerEmit checks it before CaptureStructuredLog, as SentryTarget.InnerWrite does for NLog, so a filtered entry never becomes a log.
Open points:
- How to say "off".
LogEventLevelhas noOffmember.LevelAlias.Offexists from Serilog 3.0, butSentry.Serilogreferences Serilog 2.7.1 and 2.10.0, and it's a constant rather than an enum member, so configuration binding can't parse"Off". Options: a nullable level wherenullmeans no logs,Fatal + 1, or a separate switch. - Default. To ship in a 7.x minor, the default has to keep 7.0's behaviour and send every level that reaches the sink. NLog defaults to
Info, but changing Serilog's default to match would be a behaviour change.
This was raised while sanity-checking getsentry/sentry-docs#20947, which documents the Logging.AddSentry() switch.
- Lenguaje dominante
- C#
- Estrellas
- 775
- Forks
- 262
- Merge medio
- 1 d 16 h
- PR fusionados (30 d)
- 118
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de getsentry/sentry-dotnet
-
chore: remove stale IL3050/IL3053 workaround from the iOS samplePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. AbiertoState: Needs Discussion
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
getsentry/sentry-dotnet#6071 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Heap dumps: every SDK shutdown logs "Error waiting for GarbageCollectionMonitor task to complete"Posiblemente ocupada @pcbeingused33 la tomó hoy. AbiertoState: Needs Discussion
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
getsentry/sentry-dotnet#6039 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
.NET Platform: Android Task
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
getsentry/sentry-dotnet#6020 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Move the Blazor WebAssembly sample off the deprecated DevServerPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto.NET Framework: Blazor
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
getsentry/sentry-dotnet#5906 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Docs MSBuild Needs Docs Update
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
getsentry/sentry-dotnet#5691 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de getsentry/sentry-dotnet
Issues similares
-
Audit by ear: boss warnings, other not-enough messages, ailments and barriers in a chapter 1 battleAbiertoenhancement needs-game ready-for-agent
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Sour-Dev-Home/metaphor-accessibility#1273 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
joinrpg/joinrpg-net#6336 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
muxinc/mux-csharp#88 ·
-
In-car displays show 0 km/h and P while the AV drivesPosiblemente ocupada @bazilinskyy la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
bazilinskyy/coupled-sim#366 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 3 días