Skip to content

added custom log class SequenceLog #320

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 3 commits into from
Jul 22, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public void PlatformSpecificSetup()
catch (Exception ex)
{
string message = $"Failed to register URL scheme '{_urlScheme}': {ex.Message}" + "\nSocial sign in is not currently supported on IL2CPP";
Debug.LogWarning(message);
SequenceLog.Warning(message);
throw new Exception(message);
}
#endif
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"name": "AppleAuth"
"name": "AppleAuth",
"references":[ "GUID:b4f9c0f8f363f439b9e337f79050f189" ]
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using AppleAuth.Enums;
using AppleAuth.Interfaces;
using System;
using Sequence.Utils;

namespace AppleAuth
{
Expand All @@ -16,7 +17,7 @@ static AppleAuthManager()
#if APPLE_AUTH_MANAGER_NATIVE_IMPLEMENTATION_AVAILABLE
PInvoke.AppleAuth_LogMessage(versionMessage);
#else
UnityEngine.Debug.Log(versionMessage);
SequenceLog.Info(versionMessage);
#endif
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,18 @@ private async Task<bool> SendGetSuccessRequest()
}
catch (HttpRequestException e)
{
Debug.LogError("HTTP Request failed: " + e.Message);
SequenceLog.Error("HTTP Request failed: " + e.Message);
}
catch (FormatException e)
{
Debug.LogError("Invalid URL format: " + e.Message + "\nCurl-equivalent request: " + curlRequest);
SequenceLog.Error("Invalid URL format: " + e.Message + "\nCurl-equivalent request: " + curlRequest);
}
catch (FileLoadException e)
{
Debug.LogError("File load exception: " + e.Message + "\nCurl-equivalent request: " + curlRequest);
SequenceLog.Error("File load exception: " + e.Message + "\nCurl-equivalent request: " + curlRequest);
}
catch (Exception e) {
Debug.LogError("An unexpected error occurred: " + e.Message + "\nCurl-equivalent request: " + curlRequest);
SequenceLog.Error("An unexpected error occurred: " + e.Message + "\nCurl-equivalent request: " + curlRequest);
}

return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using Newtonsoft.Json;
using Sequence.Utils;
using UnityEngine;
using UnityEngine.Scripting;

Expand All @@ -25,7 +26,7 @@ public SendERC721(string tokenAddress, string to, string tokenId, bool safe = tr
this.safe = safe;
if (!safe && data != null)
{
Debug.LogError($"Error creating {GetType().Name}: {nameof(data)} can only be set when {nameof(safe)} is true.\nUsing null data.");
SequenceLog.Error($"Error creating {GetType().Name}: {nameof(data)} can only be set when {nameof(safe)} is true.\nUsing null data.");
data = null;
}
this.data = data;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using Sequence.ABI;
using Sequence.Contracts;
using Sequence.Utils;
using UnityEngine;

namespace Sequence.EmbeddedWallet
Expand All @@ -23,7 +24,7 @@ public static void Validate(Transaction[] transactions)
if (!ABIRegex.MatchesFunctionABI(delayedEncode.data.abi))
{
string message = $"Given {nameof(DelayedEncode)} transaction with function abi {delayedEncode.data.abi} that does not match the required regex {ABIRegex.FunctionABIRegex} - for example: \"mint(uint256,uint256)\"";
Debug.LogWarning(message + "\nAttempting to recover and parse anyways");
SequenceLog.Warning(message + "\nAttempting to recover and parse anyways");
delayedEncode.data.abi = EventParser.ParseEventDef(delayedEncode.data.abi).ToString();
if (!ABIRegex.MatchesFunctionABI(delayedEncode.data.abi))
{
Expand All @@ -43,7 +44,7 @@ public static void Validate(Transaction[] transactions)
if (!ABIRegex.MatchesFunctionABI(contractCall.data.abi))
{
string message = $"Given {nameof(SequenceContractCall)} transaction with function abi {contractCall.data.abi} that does not match the required regex {ABIRegex.FunctionABIRegex} - for example: \"mint(uint256,uint256)\"";
Debug.LogWarning(message + "\nAttempting to recover and parse anyways");
SequenceLog.Warning(message + "\nAttempting to recover and parse anyways");
contractCall.data.abi = EventParser.ParseEventDef(contractCall.data.abi).ToString();
if (!ABIRegex.MatchesFunctionABI(contractCall.data.abi))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Newtonsoft.Json;
using System.Collections.Generic;
using System;
using Sequence.Utils;
using UnityEngine.Scripting;

namespace Sequence.EmbeddedWallet
Expand Down Expand Up @@ -65,7 +66,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
}
catch (Exception ex)
{
UnityEngine.Debug.LogError($"Failed to load JSON: {ex.Message}");
SequenceLog.Error($"Failed to load JSON: {ex.Message}");
throw;
}

Expand All @@ -91,7 +92,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
}
catch (Exception ex)
{
UnityEngine.Debug.LogError($"Error during JSON conversion: {ex.Message}");
SequenceLog.Error($"Error during JSON conversion: {ex.Message}");
throw;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Sequence.Utils;
using UnityEngine;
using UnityEngine.Scripting;

Expand Down Expand Up @@ -43,7 +44,7 @@ public async Task<LinkedWalletData[]> GetLinkedWallets()
}
catch (Exception e)
{
Debug.LogException(e);
SequenceLog.Exception(e);
return Array.Empty<LinkedWalletData>();
}
}
Expand Down Expand Up @@ -71,7 +72,7 @@ await client.SendRequest<LinkedWalletsRequestData, LinkedWalletsResponseData>(
}
catch (Exception e)
{
Debug.LogException(e);
SequenceLog.Exception(e);
return false;
}
}
Expand All @@ -98,7 +99,7 @@ await client.SendRequest<NonceRequestData, NonceResponseData>("",
}
catch (System.Exception e)
{
Debug.LogError($"Failed to generate EOA Wallet Link: {e}");
SequenceLog.Error($"Failed to generate EOA Wallet Link: {e}");
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Sequence.Provider;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Sequence.Utils;
using UnityEngine;
namespace Sequence.EmbeddedWallet
{
Expand Down Expand Up @@ -171,7 +172,7 @@ public async Task<TransactionReturn> SendTransaction(Chain network, Transaction[
}
catch (Exception e)
{
Debug.LogError("Error while waiting for receipt: " + e.Message);
SequenceLog.Error("Error while waiting for receipt: " + e.Message);
string receiptExString = e.Message;
var failedReturn = new FailedTransactionReturn(e.Message, null, null);
failedTransactionReturns.Add(failedReturn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ public async Task<T2> SendRequest<T, T2>(string path, T args, [CanBeNull] Dictio
UnityWebRequest request = newRequest.Item1;
string curlRequest = newRequest.Item2;
string url = newRequest.Item3;
Debug.Log(curlRequest);

SequenceLog.Info($">> {curlRequest}");

try
{
Expand Down Expand Up @@ -174,6 +175,7 @@ public async Task<T2> SendRequest<T, T2>(string path, T args, [CanBeNull] Dictio
}
try
{
SequenceLog.Info($"<< {responseJson} (from {url})");
T2 result = JsonConvert.DeserializeObject<T2>(responseJson);
return result;
}
Expand Down Expand Up @@ -254,7 +256,7 @@ public async Task<TimeSpan> GetTimeShift()
}
catch (Exception e)
{
Debug.LogError("Error getting time shift: " + e.Message);
SequenceLog.Error("Error getting time shift: " + e.Message);
return TimeSpan.Zero;
}
finally
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ public async Task<T> SendIntent<T, T2>(T2 args, IntentType type, uint timeBefore
}
else
{
Debug.LogError("Unexpected intent payload type: " + intentPayload.GetType());
SequenceLog.Error("Unexpected intent payload type: " + intentPayload.GetType());
}
if (currentTimeAccordingToServer > currentTimeAccordingToIntent + 1 ||
currentTimeAccordingToServer < currentTimeAccordingToIntent - 1)
{
Debug.LogWarning("Time mismatch detected. Retrying with server time.");
SequenceLog.Warning("Time mismatch detected. Retrying with server time.");
return await SendIntent<T, T2>(args, type, timeBeforeExpiryInSeconds, (uint)currentTimeAccordingToServer);
}
else
Expand Down Expand Up @@ -162,7 +162,7 @@ public async Task<bool> DropSession(string dropSessionId)

public async Task<T> PostIntent<T>(string payload, string path)
{
Debug.Log($"Sending intent: {path} | with payload: {payload}");
SequenceLog.Info($"Sending intent: {path} | with payload: {payload}");
Dictionary<string, string> headers = new Dictionary<string, string>();
if (typeof(T) == typeof(IntentResponse<TransactionReturn>))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private void LoadPublicKey()
catch (Exception ex)
{
string error = $"Error loading public key from JWKS: {ex.Message}";
Debug.LogError(error);
SequenceLog.Error(error);
throw new Exception(error);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void SetConnectedWalletAddress(Address connectedWalletAddress)
{
if (connectedWalletAddress == null)
{
Debug.LogError($"The connected wallet address cannot be null or empty.");
SequenceLog.Error($"The connected wallet address cannot be null or empty.");
throw new ArgumentNullException(nameof(connectedWalletAddress));
}

Expand Down Expand Up @@ -240,7 +240,7 @@ private void SetupAuthenticatorAndListeners()
_authenticator.PlatformSpecificSetup();
}
catch (Exception e) {
Debug.LogError($"Error encountered during PlatformSpecificSetup: {e.Message}\nSocial sign in will not work.");
SequenceLog.Error($"Error encountered during PlatformSpecificSetup: {e.Message}\nSocial sign in will not work.");
}
Application.deepLinkActivated += _authenticator.HandleDeepLink;
_authenticator.SignedIn += OnSocialLogin;
Expand Down Expand Up @@ -486,7 +486,7 @@ public async Task ConnectToWaaS(IntentDataOpenSession loginIntent, LoginMethod m
}
catch (Exception e)
{
Debug.LogError("Error storing session wallet securely: " + e.Message);
SequenceLog.Error("Error storing session wallet securely: " + e.Message);
}
}

Expand Down Expand Up @@ -516,7 +516,7 @@ private List<LoginMethod> ParseLoginMethods(string errorMessage)
case IdentityType.OIDC:
if (components.Length < 3)
{
Debug.LogError(
SequenceLog.Error(
"Invalid response from WaaS server, expected at least 3 components in OIDC login method string");
}

Expand All @@ -538,7 +538,7 @@ private List<LoginMethod> ParseLoginMethods(string errorMessage)
}
else
{
Debug.LogError("Unexpected OIDC login method string: " + components[2]);
SequenceLog.Error("Unexpected OIDC login method string: " + components[2]);
}
break;
case IdentityType.Email:
Expand All @@ -551,7 +551,7 @@ private List<LoginMethod> ParseLoginMethods(string errorMessage)
methods.Add(LoginMethod.PlayFab);
break;
default:
Debug.LogError("Unexpected identity type " + identityType);
SequenceLog.Error("Unexpected identity type " + identityType);
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private async Task<TransactionReturn> SendTransactionIntent(IntentDataSendTransa
}
catch (Exception e)
{
Debug.LogError("Transaction was successful, but we're unable to obtain the transaction hash. Reason: " + e.Message);
SequenceLog.Error("Transaction was successful, but we're unable to obtain the transaction hash. Reason: " + e.Message);
OnSendTransactionComplete?.Invoke(successfulTransactionReturn);
return result;
}
Expand Down Expand Up @@ -231,7 +231,7 @@ public async Task<bool> DropSession(string dropSessionId)
}
else
{
Debug.LogError("Failed to drop sessionId: " + dropSessionId);
SequenceLog.Error("Failed to drop sessionId: " + dropSessionId);
}
return result;
}
Expand All @@ -251,7 +251,7 @@ public async Task<Session[]> ListSessions()
}
catch (Exception e)
{
Debug.LogWarning("Failed to list sessions: " + e.Message);
SequenceLog.Warning("Failed to list sessions: " + e.Message);
}
OnSessionsFound?.Invoke(results);
return results;
Expand All @@ -267,7 +267,7 @@ public async Task<SuccessfulTransactionReturn> WaitForTransactionReceipt(Success
}
catch (Exception e)
{
Debug.LogError("Transaction was successful, but we're unable to obtain the transaction hash. Reason: " + e.Message);
SequenceLog.Error("Transaction was successful, but we're unable to obtain the transaction hash. Reason: " + e.Message);
return successfulTransactionReturn;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public static string FunctionSelector(string functionSignature)
}
catch (Exception ex)
{
Debug.LogError($"Error generating function selector: {ex.Message}");
SequenceLog.Error($"Error generating function selector: {ex.Message}");
return string.Empty;
}
}
Expand Down Expand Up @@ -359,7 +359,7 @@ public static ABIType GetParameterType(object param)
}
catch (Exception ex)
{
Debug.LogError($"Error determining parameter type: {ex.Message}");
SequenceLog.Error($"Error determining parameter type: {ex.Message}");
}

return ABIType.NONE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public object Decode(byte[] encoded)
}
catch (Exception ex)
{
Debug.LogError($"Failed to decode address: {ex.Message}");
SequenceLog.Error($"Failed to decode address: {ex.Message}");
return null;
}
}
Expand All @@ -46,7 +46,7 @@ public byte[] Encode(object value)
}
catch (Exception ex)
{
Debug.LogError($"Failed to encode address: {ex.Message}");
SequenceLog.Error($"Failed to encode address: {ex.Message}");
return new byte[0];
}
}
Expand Down Expand Up @@ -80,7 +80,7 @@ public string EncodeToString(object value)
}
catch (Exception ex)
{
Debug.LogError($"Failed to encode address to string: {ex.Message}");
SequenceLog.Error($"Failed to encode address to string: {ex.Message}");
return string.Empty;
}
}
Expand All @@ -104,7 +104,7 @@ public string DecodeFromString(string encodedString)
}
catch (Exception ex)
{
Debug.LogError($"Failed to decode address from string: {ex.Message}");
SequenceLog.Error($"Failed to decode address from string: {ex.Message}");
return string.Empty;
}
}
Expand All @@ -123,7 +123,7 @@ public static string Decode(string encodedString)
}
catch (Exception ex)
{
Debug.LogError($"Failed to decode address: {ex.Message}");
SequenceLog.Error($"Failed to decode address: {ex.Message}");
return null;
}
}
Expand Down
Loading