From a33dc2f4919f7fdc8ea9db41c4c70c38cedfd3df Mon Sep 17 00:00:00 2001 From: mageven <62494521+mageven@users.noreply.github.com> Date: Tue, 4 Aug 2020 05:02:53 +0530 Subject: Improved Logger (#1292) * Logger class changes only Now compile-time checking is possible with the help of Nullable Value types. * Misc formatting * Manual optimizations PrintGuestLog PrintGuestStackTrace Surfaceflinger DequeueBuffer * Reduce SendVibrationXX log level to Debug * Add Notice log level This level is always enabled and used to print system info, etc... Also, rewrite LogColor to switch expression as colors are static * Unify unhandled exception event handlers * Print enabled LogLevels during init * Re-add App Exit disposes in proper order nit: switch case spacing * Revert PrintGuestStackTrace to Info logs due to #1407 PrintGuestStackTrace is now called in some critical error handlers so revert to old behavior as KThread isn't part of Guest. * Batch replace Logger statements --- .../ApplicationProxy/IApplicationFunctions.cs | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs') diff --git a/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs b/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs index ac24dfc9..5b26b981 100644 --- a/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs +++ b/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs @@ -65,7 +65,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati control.UserAccountSaveDataSize = 0x4000; control.UserAccountSaveDataJournalSize = 0x4000; - Logger.PrintWarning(LogClass.ServiceAm, + Logger.Warning?.Print(LogClass.ServiceAm, "No control file was found for this game. Using a dummy one instead. This may cause inaccuracies in some games."); } @@ -93,7 +93,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati if (firstSupported > (int)SystemState.TitleLanguage.Chinese) { - Logger.PrintWarning(LogClass.ServiceAm, "Application has zero supported languages"); + Logger.Warning?.Print(LogClass.ServiceAm, "Application has zero supported languages"); context.ResponseData.Write(desiredLanguageCode); @@ -107,7 +107,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati SystemLanguage newLanguage = Enum.Parse(Enum.GetName(typeof(SystemState.TitleLanguage), firstSupported)); desiredLanguageCode = SystemStateMgr.GetLanguageCode((int)newLanguage); - Logger.PrintInfo(LogClass.ServiceAm, $"Application doesn't support configured language. Using {newLanguage}"); + Logger.Info?.Print(LogClass.ServiceAm, $"Application doesn't support configured language. Using {newLanguage}"); } context.ResponseData.Write(desiredLanguageCode); @@ -121,7 +121,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati { Result result = new Result(context.RequestData.ReadUInt32()); - Logger.PrintInfo(LogClass.ServiceAm, $"Result = 0x{result.Value:x8} ({result.ToStringWithName()})."); + Logger.Info?.Print(LogClass.ServiceAm, $"Result = 0x{result.Value:x8} ({result.ToStringWithName()})."); return ResultCode.Success; } @@ -149,7 +149,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati // TODO: We return a size of 2GB as we use a directory based save system. This should be enough for most of the games. context.ResponseData.Write(2000000000u); - Logger.PrintStub(LogClass.ServiceAm, new { saveDataType, userId }); + Logger.Stub?.PrintStub(LogClass.ServiceAm, new { saveDataType, userId }); return ResultCode.Success; } @@ -170,7 +170,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati context.ResponseData.Write(0L); context.ResponseData.Write(0L); - Logger.PrintStub(LogClass.ServiceAm); + Logger.Stub?.PrintStub(LogClass.ServiceAm); return ResultCode.Success; } @@ -179,7 +179,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati // InitializeGamePlayRecording(u64, handle) public ResultCode InitializeGamePlayRecording(ServiceCtx context) { - Logger.PrintStub(LogClass.ServiceAm); + Logger.Stub?.PrintStub(LogClass.ServiceAm); return ResultCode.Success; } @@ -190,7 +190,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati { int state = context.RequestData.ReadInt32(); - Logger.PrintStub(LogClass.ServiceAm, new { state }); + Logger.Stub?.PrintStub(LogClass.ServiceAm, new { state }); return ResultCode.Success; } @@ -201,7 +201,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati { bool applicationCrashReportEnabled = context.RequestData.ReadBoolean(); - Logger.PrintStub(LogClass.ServiceAm, new { applicationCrashReportEnabled }); + Logger.Stub?.PrintStub(LogClass.ServiceAm, new { applicationCrashReportEnabled }); return ResultCode.Success; } @@ -246,7 +246,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati { // TODO: Initialize buffer and object. - Logger.PrintStub(LogClass.ServiceAm, new { transferMemoryAddress, transferMemorySize, width, height }); + Logger.Stub?.PrintStub(LogClass.ServiceAm, new { transferMemoryAddress, transferMemorySize, width, height }); resultCode = ResultCode.Success; } @@ -282,7 +282,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati } } - Logger.PrintStub(LogClass.ServiceAm, new { frameBufferPos, frameBufferSize, x, y, width, height, windowOriginMode }); + Logger.Stub?.PrintStub(LogClass.ServiceAm, new { frameBufferPos, frameBufferSize, x, y, width, height, windowOriginMode }); return resultCode; } @@ -296,7 +296,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati } */ - Logger.PrintStub(LogClass.ServiceAm, new { x, y, width, height, frameBufferPos, frameBufferSize, windowOriginMode }); + Logger.Stub?.PrintStub(LogClass.ServiceAm, new { x, y, width, height, frameBufferPos, frameBufferSize, windowOriginMode }); return ResultCode.Success; } @@ -307,7 +307,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati { bool visible = context.RequestData.ReadBoolean(); - Logger.PrintStub(LogClass.ServiceAm, new { visible }); + Logger.Stub?.PrintStub(LogClass.ServiceAm, new { visible }); // NOTE: It sets an internal field and return ResultCode.Success in all case. @@ -341,7 +341,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati context.ResponseData.Write(previousProgramIndex); - Logger.PrintStub(LogClass.ServiceAm, new { previousProgramIndex }); + Logger.Stub?.PrintStub(LogClass.ServiceAm, new { previousProgramIndex }); return ResultCode.Success; } -- cgit v1.2.3