Skip to content

Commit

Permalink
chore: update CLI to v2.2.0 (#826)
Browse files Browse the repository at this point in the history
* chore: update sentry-cli to v2.2.0

* feat: native post-process - improve CLI logging
  • Loading branch information
vaind authored Jun 20, 2022
1 parent 7da6fd1 commit f7a136c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
- Bump Native SDK to v0.4.18 ([#810](https://github.com/getsentry/sentry-unity/pull/810) & [#824](https://github.com/getsentry/sentry-unity/pull/824))
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0418)
- [diff](https://github.com/getsentry/sentry-native/compare/0.4.15-7-g9eecb1b...0.4.18)
- Bump CLI to v2.2.0 ([#826](https://github.com/getsentry/sentry-unity/pull/826))
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#220)
- [diff](https://github.com/getsentry/sentry-cli/compare/1.71.0...2.2.0)

## 0.19.0

Expand Down
2 changes: 1 addition & 1 deletion scripts/download-sentry-cli.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Set-StrictMode -Version latest

$version = '1.71.0'
$version = '2.2.0'
$platforms = @('Darwin-universal', 'Linux-x86_64', 'Windows-x86_64')
$targetDir = "$PSScriptRoot/../package-dev/Editor/sentry-cli"
$baseUrl = "https://github.com/getsentry/sentry-cli/releases/download/$version/sentry-cli-"
Expand Down
27 changes: 25 additions & 2 deletions src/Sentry.Unity.Editor/Native/BuildPostProcess.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.IO;
using Sentry.Extensibility;
using System.Text.RegularExpressions;
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Callbacks;
Expand Down Expand Up @@ -181,8 +182,30 @@ private static void UploadDebugSymbols(IDiagnosticLogger logger, BuildTarget tar
process.StartInfo.EnvironmentVariables["SENTRY_ORG"] = cliOptions.Organization;
process.StartInfo.EnvironmentVariables["SENTRY_PROJECT"] = cliOptions.Project;
process.StartInfo.EnvironmentVariables["SENTRY_AUTH_TOKEN"] = cliOptions.Auth;
process.OutputDataReceived += (sender, args) => logger.LogDebug($"sentry-cli: {args.Data.ToString()}");
process.ErrorDataReceived += (sender, args) => logger.LogError($"sentry-cli: {args.Data.ToString()}");
process.StartInfo.EnvironmentVariables["SENTRY_LOG_LEVEL"] = "info";

DataReceivedEventHandler logForwarder = (object sender, DataReceivedEventArgs e) =>
{
var msg = e.Data.ToString().Trim();
var msgLower = msg.ToLowerInvariant();
var level = SentryLevel.Info;
if (msgLower.StartsWith("error"))
{
level = SentryLevel.Error;
}
else if (msgLower.StartsWith("warn"))
{
level = SentryLevel.Warning;
}
// Remove the level and timestamp from the beginning of the message.
// INFO 2022-06-20 15:10:03.613794800 +02:00
msg = Regex.Replace(msg, "^[a-zA-Z]+ +[0-9\\-]{10} [0-9:]{8}\\.[0-9]+ \\+[0-9:]{5} +", "");
logger.Log(level, "sentry-cli: {0}", null, msg);
};

process.OutputDataReceived += logForwarder;
process.ErrorDataReceived += logForwarder;
process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
Expand Down

0 comments on commit f7a136c

Please sign in to comment.