Move logging to Ryujinx.Common and make it a static class (#413)

This commit is contained in:
ReinUsesLisp 2018-10-17 14:15:50 -03:00 committed by gdkchan
parent 9b19ea3c87
commit b3a4662be1
61 changed files with 612 additions and 585 deletions

View file

@ -1,5 +1,5 @@
using ChocolArm64.State;
using Ryujinx.HLE.Logging;
using Ryujinx.Common.Logging;
using System.Collections.Generic;
using static Ryujinx.HLE.HOS.ErrorCode;
@ -14,7 +14,7 @@ namespace Ryujinx.HLE.HOS.Kernel
int HandlesCount = (int)ThreadState.X2;
long Timeout = (long)ThreadState.X3;
Device.Log.PrintDebug(LogClass.KernelSvc,
Logger.PrintDebug(LogClass.KernelSvc,
"HandlesPtr = 0x" + HandlesPtr .ToString("x16") + ", " +
"HandlesCount = 0x" + HandlesCount.ToString("x8") + ", " +
"Timeout = 0x" + Timeout .ToString("x16"));
@ -53,11 +53,11 @@ namespace Ryujinx.HLE.HOS.Kernel
if (Result == MakeError(ErrorModule.Kernel, KernelErr.Timeout) ||
Result == MakeError(ErrorModule.Kernel, KernelErr.Cancelled))
{
Device.Log.PrintDebug(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
Logger.PrintDebug(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
}
else
{
Device.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
Logger.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
}
}
@ -69,13 +69,13 @@ namespace Ryujinx.HLE.HOS.Kernel
{
int ThreadHandle = (int)ThreadState.X0;
Device.Log.PrintDebug(LogClass.KernelSvc, "ThreadHandle = 0x" + ThreadHandle.ToString("x8"));
Logger.PrintDebug(LogClass.KernelSvc, "ThreadHandle = 0x" + ThreadHandle.ToString("x8"));
KThread Thread = Process.HandleTable.GetKThread(ThreadHandle);
if (Thread == null)
{
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{ThreadHandle:x8}!");
Logger.PrintWarning(LogClass.KernelSvc, $"Invalid thread handle 0x{ThreadHandle:x8}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidHandle);
@ -93,14 +93,14 @@ namespace Ryujinx.HLE.HOS.Kernel
long MutexAddress = (long)ThreadState.X1;
int RequesterHandle = (int)ThreadState.X2;
Device.Log.PrintDebug(LogClass.KernelSvc,
Logger.PrintDebug(LogClass.KernelSvc,
"OwnerHandle = 0x" + OwnerHandle .ToString("x8") + ", " +
"MutexAddress = 0x" + MutexAddress .ToString("x16") + ", " +
"RequesterHandle = 0x" + RequesterHandle.ToString("x8"));
if (IsPointingInsideKernel(MutexAddress))
{
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid mutex address 0x{MutexAddress:x16}!");
Logger.PrintWarning(LogClass.KernelSvc, $"Invalid mutex address 0x{MutexAddress:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm);
@ -109,7 +109,7 @@ namespace Ryujinx.HLE.HOS.Kernel
if (IsAddressNotWordAligned(MutexAddress))
{
Device.Log.PrintWarning(LogClass.KernelSvc, $"Unaligned mutex address 0x{MutexAddress:x16}!");
Logger.PrintWarning(LogClass.KernelSvc, $"Unaligned mutex address 0x{MutexAddress:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress);
@ -125,7 +125,7 @@ namespace Ryujinx.HLE.HOS.Kernel
if (Result != 0)
{
Device.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
Logger.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
}
ThreadState.X0 = (ulong)Result;
@ -135,11 +135,11 @@ namespace Ryujinx.HLE.HOS.Kernel
{
long MutexAddress = (long)ThreadState.X0;
Device.Log.PrintDebug(LogClass.KernelSvc, "MutexAddress = 0x" + MutexAddress.ToString("x16"));
Logger.PrintDebug(LogClass.KernelSvc, "MutexAddress = 0x" + MutexAddress.ToString("x16"));
if (IsPointingInsideKernel(MutexAddress))
{
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid mutex address 0x{MutexAddress:x16}!");
Logger.PrintWarning(LogClass.KernelSvc, $"Invalid mutex address 0x{MutexAddress:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm);
@ -148,7 +148,7 @@ namespace Ryujinx.HLE.HOS.Kernel
if (IsAddressNotWordAligned(MutexAddress))
{
Device.Log.PrintWarning(LogClass.KernelSvc, $"Unaligned mutex address 0x{MutexAddress:x16}!");
Logger.PrintWarning(LogClass.KernelSvc, $"Unaligned mutex address 0x{MutexAddress:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress);
@ -159,7 +159,7 @@ namespace Ryujinx.HLE.HOS.Kernel
if (Result != 0)
{
Device.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
Logger.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
}
ThreadState.X0 = (ulong)Result;
@ -172,7 +172,7 @@ namespace Ryujinx.HLE.HOS.Kernel
int ThreadHandle = (int)ThreadState.X2;
long Timeout = (long)ThreadState.X3;
Device.Log.PrintDebug(LogClass.KernelSvc,
Logger.PrintDebug(LogClass.KernelSvc,
"MutexAddress = 0x" + MutexAddress .ToString("x16") + ", " +
"CondVarAddress = 0x" + CondVarAddress.ToString("x16") + ", " +
"ThreadHandle = 0x" + ThreadHandle .ToString("x8") + ", " +
@ -180,7 +180,7 @@ namespace Ryujinx.HLE.HOS.Kernel
if (IsPointingInsideKernel(MutexAddress))
{
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid mutex address 0x{MutexAddress:x16}!");
Logger.PrintWarning(LogClass.KernelSvc, $"Invalid mutex address 0x{MutexAddress:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm);
@ -189,7 +189,7 @@ namespace Ryujinx.HLE.HOS.Kernel
if (IsAddressNotWordAligned(MutexAddress))
{
Device.Log.PrintWarning(LogClass.KernelSvc, $"Unaligned mutex address 0x{MutexAddress:x16}!");
Logger.PrintWarning(LogClass.KernelSvc, $"Unaligned mutex address 0x{MutexAddress:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress);
@ -207,11 +207,11 @@ namespace Ryujinx.HLE.HOS.Kernel
{
if (Result == MakeError(ErrorModule.Kernel, KernelErr.Timeout))
{
Device.Log.PrintDebug(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
Logger.PrintDebug(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
}
else
{
Device.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
Logger.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
}
}
@ -223,7 +223,7 @@ namespace Ryujinx.HLE.HOS.Kernel
long Address = (long)ThreadState.X0;
int Count = (int)ThreadState.X1;
Device.Log.PrintDebug(LogClass.KernelSvc,
Logger.PrintDebug(LogClass.KernelSvc,
"Address = 0x" + Address.ToString("x16") + ", " +
"Count = 0x" + Count .ToString("x8"));
@ -239,7 +239,7 @@ namespace Ryujinx.HLE.HOS.Kernel
int Value = (int)ThreadState.X2;
long Timeout = (long)ThreadState.X3;
Device.Log.PrintDebug(LogClass.KernelSvc,
Logger.PrintDebug(LogClass.KernelSvc,
"Address = 0x" + Address.ToString("x16") + ", " +
"Type = " + Type .ToString() + ", " +
"Value = 0x" + Value .ToString("x8") + ", " +
@ -247,7 +247,7 @@ namespace Ryujinx.HLE.HOS.Kernel
if (IsPointingInsideKernel(Address))
{
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid address 0x{Address:x16}!");
Logger.PrintWarning(LogClass.KernelSvc, $"Invalid address 0x{Address:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm);
@ -256,7 +256,7 @@ namespace Ryujinx.HLE.HOS.Kernel
if (IsAddressNotWordAligned(Address))
{
Device.Log.PrintWarning(LogClass.KernelSvc, $"Unaligned address 0x{Address:x16}!");
Logger.PrintWarning(LogClass.KernelSvc, $"Unaligned address 0x{Address:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress);
@ -286,7 +286,7 @@ namespace Ryujinx.HLE.HOS.Kernel
if (Result != 0)
{
Device.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
Logger.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
}
ThreadState.X0 = (ulong)Result;
@ -299,7 +299,7 @@ namespace Ryujinx.HLE.HOS.Kernel
int Value = (int)ThreadState.X2;
int Count = (int)ThreadState.X3;
Device.Log.PrintDebug(LogClass.KernelSvc,
Logger.PrintDebug(LogClass.KernelSvc,
"Address = 0x" + Address.ToString("x16") + ", " +
"Type = " + Type .ToString() + ", " +
"Value = 0x" + Value .ToString("x8") + ", " +
@ -307,7 +307,7 @@ namespace Ryujinx.HLE.HOS.Kernel
if (IsPointingInsideKernel(Address))
{
Device.Log.PrintWarning(LogClass.KernelSvc, $"Invalid address 0x{Address:x16}!");
Logger.PrintWarning(LogClass.KernelSvc, $"Invalid address 0x{Address:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.NoAccessPerm);
@ -316,7 +316,7 @@ namespace Ryujinx.HLE.HOS.Kernel
if (IsAddressNotWordAligned(Address))
{
Device.Log.PrintWarning(LogClass.KernelSvc, $"Unaligned address 0x{Address:x16}!");
Logger.PrintWarning(LogClass.KernelSvc, $"Unaligned address 0x{Address:x16}!");
ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidAddress);
@ -346,7 +346,7 @@ namespace Ryujinx.HLE.HOS.Kernel
if (Result != 0)
{
Device.Log.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
Logger.PrintWarning(LogClass.KernelSvc, $"Operation failed with error 0x{Result:x}!");
}
ThreadState.X0 = (ulong)Result;