Skip to content

Logging is getting set up twice #2248

@bitsandfoxes

Description

@bitsandfoxes

Description

We've got an extension to the options that allows us to set up logging in the same fashion the .NET SDK does:

internal static void SetupUnityLogging(this SentryUnityOptions options)
{
if (options.Debug)
{
if (options.DiagnosticLogger is null)
{
options.DiagnosticLogger = new UnityLogger(options);
options.DiagnosticLogger.LogDebug("Logging enabled with 'UnityLogger' min level: {0}", options.DiagnosticLevel);
}
}
else
{
options.DiagnosticLogger = null;
}
}

This is getting invoked in two places right now:

leading to duplication of some warnings i.e.

Sentry: (Warning) Sentry option 'Debug' is set to true while Environment is production. Be aware this can cause performance degradation and is not advised. See https://docs.sentry.io/platforms/dotnet/configuration/diagnostic-logger for more information

This was due to the platform specific configuration happening outside of Init. Otherwise we'd miss out on some log-messages. With the rework to the Initialization flow in #2227 it should now be fine to set up logging during initialization only.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions