chore: add log for #6006

This commit is contained in:
MistEO
2023-08-28 19:45:46 +08:00
parent b683982381
commit 284dcda06e
2 changed files with 8 additions and 1 deletions

View File

@@ -111,6 +111,7 @@ AsstBool AsstSetInstanceOption(AsstHandle handle, AsstInstanceOptionKey key, con
AsstBool AsstConnect(AsstHandle handle, const char* adb_path, const char* address, const char* config)
{
if (!inited() || handle == nullptr) {
asst::Log.error(__FUNCTION__, "Cannot connect to device, asst not inited or handle is nullptr", inited(), handle);
return AsstFalse;
}

View File

@@ -28,6 +28,7 @@ using MaaWpfGui.States;
using MaaWpfGui.ViewModels.UI;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Serilog;
using Stylet;
namespace MaaWpfGui.Main
@@ -49,6 +50,7 @@ namespace MaaWpfGui.Main
public class AsstProxy
{
private readonly RunningState runningState;
private static readonly ILogger _logger = Log.ForContext<AsstProxy>();
private delegate void CallbackDelegate(int msg, IntPtr json_buffer, IntPtr custom_arg);
@@ -106,11 +108,15 @@ namespace MaaWpfGui.Main
private static unsafe bool AsstConnect(AsstHandle handle, string adb_path, string address, string config)
{
_logger.Information(((int)handle).ToString(), adb_path, address, config);
fixed (byte* ptr1 = EncodeNullTerminatedUTF8(adb_path),
ptr2 = EncodeNullTerminatedUTF8(address),
ptr3 = EncodeNullTerminatedUTF8(config))
{
return AsstConnect(handle, ptr1, ptr2, ptr3);
bool ret = AsstConnect(handle, ptr1, ptr2, ptr3);
_logger.Information(((int)handle).ToString(), adb_path, address, config, "return", ret);
return ret;
}
}