Skip to content

Commit 1ad0241

Browse files
committed
Debug logging
1 parent e216101 commit 1ad0241

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

Assets/Scripts/Config/ArgumentReader.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
using System;
2+
using UnityEngine;
23

34
public static class ArgumentReader
45
{
56
public static string GetCommandLineArg(string name)
67
{
78
var args = Environment.GetCommandLineArgs();
9+
Debug.Log($"Received {args.Length} arguments.");
10+
for (var i = 0; i < args.Length; i++)
11+
{
12+
if (args[i].StartsWith("-"))
13+
{
14+
Debug.Log($" {args[i]}");
15+
}
16+
}
17+
818
for (var i = 0; i < args.Length; i++)
919
{
1020
if (args[i] == "-" + name && args.Length > i + 1)

Assets/Scripts/Config/SentryCliConfiguration.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
1-
using System;
21
using Sentry.Unity;
2+
using UnityEngine;
33

44
public class SentryCliConfiguration : SentryCliOptionsConfiguration
55
{
66
public override void Configure(SentryCliOptions cliOptions)
77
{
8+
Debug.Log("Calling into the 'Configure' callback for CLI options.");
9+
810
if (cliOptions.Auth is not null)
911
{
12+
Debug.Log("The 'AUTH TOKEN' is already set.");
1013
return;
1114
}
1215

16+
Debug.Log("Getting the 'AUTH TOKEN' from the commandline arguments.");
1317
var token = ArgumentReader.GetCommandLineArg("auth_token");
1418
if (!string.IsNullOrEmpty(token))
1519
{
20+
Debug.Log("Setting the 'AUTH TOKEN'.");
1621
cliOptions.Auth = token;
1722
}
1823
else
1924
{
20-
throw new InvalidOperationException("Failed to fetch `auth_token` from the command line arguments");
25+
Debug.LogError("Failed to get the 'AUTH TOKEN'.");
2126
}
2227

2328
cliOptions.Organization = "demo";
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
1-
using System;
21
using Sentry.Unity;
2+
using UnityEngine;
33

44
public class SentryOptionConfiguration : SentryOptionsConfiguration
55
{
66
public override void Configure(SentryUnityOptions options)
77
{
8+
Debug.Log("Calling into the 'Configure' callback.");
9+
810
if (options.Dsn is not null)
911
{
12+
Debug.Log("The 'DSN' is already set.");
1013
return;
1114
}
1215

16+
Debug.Log("Getting the 'DSN' from the commandline arguments.");
1317
var dsn = ArgumentReader.GetCommandLineArg("dsn");
1418
if (!string.IsNullOrEmpty(dsn))
1519
{
20+
Debug.Log("Setting the 'DSN'.");
1621
options.Dsn = dsn;
1722
}
1823
else
1924
{
20-
throw new InvalidOperationException("Failed to fetch `dsn` from the command line arguments");
25+
Debug.LogError("Failed to get the 'DSN'.");
2126
}
2227
}
2328
}

0 commit comments

Comments
 (0)