Skip to content

Conversation

Flash0ver
Copy link
Member

@Flash0ver Flash0ver commented Jun 25, 2025

@Flash0ver Flash0ver self-assigned this Jun 25, 2025
@Flash0ver Flash0ver changed the title WIP: add Sentry Logs WIP: add Sentry Logs (experimental) Jun 25, 2025
@Flash0ver Flash0ver added the Logs label Jul 22, 2025
Flash0ver and others added 6 commits July 29, 2025 10:52
… `Sentry.AspNetCore` and `Sentry.Maui` (#4193)

* feat(logs): initial experiment

* feat(logs): basic Logger Module API shape

* style(logs): consolidate

* ref(logs): remove generic WriteSerializable overload

* ref(logs): consolidate experimental Diagnostic-ID

* feat(logs): add experimental options

* ref(logs): remove custom polyfills now provided through Polyfill

* Format code

* ref(logs): move types out of Experimental namespace

* feat(logs): change 'integer' from Int32 to Int64

* ref(logs): refine API surface area

* ref(logs): match SeverityLevel to OTel spec

* ref(logs): rename SentrySeverity to LogSeverityLevel

* Format code

* ref(logs): hide underlying Dictionary`2 for Attributes

* ref(logs): restructure attributes

* ref(logs): extract TraceId and ParentSpanId methods

* ref(logs): remove `SentryOptions.LogsSampleRate`

* feat(logs): support ISystemClock abstraction

* ref(logs): disambiguate SentryLogger names

* ref(logs): consolidate names of Log-Methods

* ref(logs): rename LogSeverityLevel to SentryLogLevel

* ref(logs): re-rename new logger type

* ref(logs): move Logger instances to Hubs

* test(logs): add tests

* Format code

* fix(logs): incorrectly serializing attributes

* fix(logs): do not capture log when template/parameters are invalid

* fix(logs): do not capture log on user callback exceptions

* ref(logs): move new public types to root namespace

* ref(logs): rework sample

* ref(logs): ensure that DisabledHub dues not capture logs

* ref(logs): allow out-of-range Log-Level

* docs(logs): add XML comments indicating that logs will be ignored on delegate exceptions

* docs(logs): add to changelog

* fix(logs): add to Bindable-Options

* fix(logs): add to ApiApprovalTests

* test(logs): add missing net48 ApiApproval

* test(logs): fix line endings on Windows

* Update src/Sentry/Protocol/Envelopes/Envelope.cs

Co-authored-by: Bruno Garcia <[email protected]>

* Update SentryLog.cs

Co-Authored-By: Bruno Garcia <[email protected]>

* test(logs): fix floating-point ToString expectation for .NET Framework

* ref(logs): remove some using declarations

* test(ci): trying to work around floating-point formatter on .NET Framework

* test(logs): skip failing tests on Mono (non-Windows)

* test(log): fix Skip.If missing SkippableFact

* try: fix floating-point formatting on Windows

* feat(logs): Sentry.Extensions.Logging

* feat(logs): Sentry.AspNetCore

* feat(logs): Sentry.Maui

* fix(logs): Logging Filter

* Format code

* feat(logs): add CHANGELOG entry

* release: 5.8.0-alpha.0

* ref: make SentryStructuredLogger abstract

* docs: add comment to sample usage of SetBeforeSendLog

Co-authored-by: Bruno Garcia <[email protected]>

* ref: clarify intent of usages of Debug.Assert

* docs: improve XML comments

* test: range of Severity-Number specification

* test: GetValuesAsUnderlyingType of the new enum

* ref: move Log options to Experimental section

* ref: move Logger to Experimental section of SDK

* test: add Hub tests

* test: update verified public API

* docs: update CHANGELOG.md

* ref: move Log-rerelated Options to Experimental sub-section

* ref: reuse Disabled-Instance when Structured-Logging is not enabled

* ref: remove Enabled-checks on Default-Logger

* ref: rename DisabledSentryStructuredLogger to NoOpSentryStructuredLogger

* ref: make `BindableSentryOptions.Experimental` internal

Co-authored-by: James Crosswell <[email protected]>

* Revert "ref: make `BindableSentryOptions.Experimental` internal"

This reverts commit 45b8687.

* docs: Update CHANGELOG.md

Co-authored-by: Bruno Garcia <[email protected]>

* Revert "ref: rename DisabledSentryStructuredLogger to NoOpSentryStructuredLogger"

This reverts commit c0a1cd5.

* ref: replace use of ScopeManager with TraceHeader

* test: remove Skip as we no longer test net48 against non-Windows

* feat: support more numeric types

* feat: support char attributes

* fix: build error targeting .NET Standard 2.0 and .NET Framework

* fix: exception when passing null as message parameter

* test: add Attributes-To-Json test

* fix: missing type on .NET Framework

* feat: support Attribute-Types from spec

* ref: clarify internal identifiers

* test: update approved API

* test: fix incorrect expectation

* feat: use "wrapping" SDK's Name and Version

* fix: Get-Attribute-API

* docs: update CHANGELOG

* docs: update CHANGELOG

* test: change options to Experimental section

* docs: merge CHANGELOG

* ref/fix: M.E.L integrations

* fix: M.E.L. formatter may throw when CA2017 is violated

* fix: Logger uses .NET MAUI SDK name

* fix: send log timestamp with milliseconds

* perf: avoid redundant array copy

* Update CHANGELOG.md

* ref(docs): remove ExperimentalAttribute on internal types and members

* style(logs): use Recursive Pattern Matching

Co-authored-by: James Crosswell <[email protected]>

* test(logs): add coverage for missing message

---------

Co-authored-by: Sentry Github Bot <[email protected]>
Co-authored-by: Bruno Garcia <[email protected]>
Co-authored-by: Bruno Garcia <[email protected]>
Co-authored-by: getsentry-bot <[email protected]>
Co-authored-by: getsentry-bot <[email protected]>
Co-authored-by: James Crosswell <[email protected]>
Copy link
Contributor

github-actions bot commented Aug 6, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 05b8f31

@Flash0ver Flash0ver changed the title WIP: add Sentry Logs (experimental) feat: add Sentry Logs (experimental) Aug 6, 2025
@Flash0ver Flash0ver marked this pull request as ready for review August 6, 2025 13:57
@Flash0ver Flash0ver requested a review from bruno-garcia August 6, 2025 13:57
@jamescrosswell jamescrosswell self-requested a review August 7, 2025 00:39
Copy link
Collaborator

@jamescrosswell jamescrosswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we're 95% there (once it's passing CI).

@Flash0ver and I discussed merging this logger with our other logger, so that we can elegantly handle things like ILogger.BeginScope but this is already pretty solid for an experimental feature so let's get it out there and get some feedback while we work on those other things.

Nice work Stefan! ❤️ 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants