Skip to content

take logging verbosity for cli from options #1693

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

### Fixes

- The SDKs loglevel now also applies to sentry-cli logging ([#1693](https://github.com/getsentry/sentry-unity/pull/1693))
- When targeting Android, sentry-cli will now log to the editor console ([#1693](https://github.com/getsentry/sentry-unity/pull/1691))

### Features

- Added an `IgnoreCliErrors` to the Sentry-CLI options, allowing you to ignore errors during symbol and mapping upload ([#1687](https://github.com/getsentry/sentry-unity/pull/1687))
Expand Down
15 changes: 14 additions & 1 deletion src/Sentry.Unity.Editor/SentryCli.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static string CreateSentryProperties(string propertiesPath, SentryCliOpti
properties.WriteLine($"defaults.project={cliOptions.Project}");
properties.WriteLine($"auth.token={cliOptions.Auth}");
properties.WriteLine("dif.max_item_size=10485760"); // 10 MiB
properties.WriteLine("log.level=debug");
properties.WriteLine($"log.level={options.DiagnosticLevel.ToCliLogLevel()}");

return propertiesFile;
}
Expand Down Expand Up @@ -112,5 +112,18 @@ internal static void SetExecutePermission(string? filePath = null, IApplication?
}
return string.IsNullOrEmpty(result) ? null : result;
}

private static string ToCliLogLevel(this SentryLevel level)
{
return level switch
{
SentryLevel.Debug => "debug",
SentryLevel.Info => "info",
SentryLevel.Warning => "warn",
SentryLevel.Error => "error",
SentryLevel.Fatal => "error",
_ => throw new ArgumentOutOfRangeException(nameof(level), level, null)
};
}
}
}
Loading