Marked Async-compatibility issue with Log() in LoggerService.cs

This commit is contained in:
MapleWheels
2026-01-06 07:46:07 -05:00
committed by Maplewheels
parent d6968f4ea9
commit 42acb32c69
@@ -1,4 +1,5 @@
using System; using System;
using System.Linq;
using Barotrauma.Networking; using Barotrauma.Networking;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using MoonSharp.Interpreter; using MoonSharp.Interpreter;
@@ -80,6 +81,8 @@ public partial class LoggerService : ILoggerService
public void Log(string message, Color? color = null, ServerLog.MessageType messageType = ServerLog.MessageType.ServerMessage) public void Log(string message, Color? color = null, ServerLog.MessageType messageType = ServerLog.MessageType.ServerMessage)
{ {
// TODO: Make this thread Async compatible.
if (HideUserNames && !Environment.UserName.IsNullOrEmpty()) if (HideUserNames && !Environment.UserName.IsNullOrEmpty())
{ {
message = message.Replace(Environment.UserName, "USERNAME"); message = message.Replace(Environment.UserName, "USERNAME");
@@ -142,15 +145,18 @@ public partial class LoggerService : ILoggerService
return; return;
} }
foreach (var error in result.Errors) if (result.Errors.Any())
{ {
LogError(error.Message); foreach (var error in result.Errors)
if (error.Reasons != null)
{ {
foreach (var reason in error.Reasons) LogError(error.Message);
if (error.Reasons != null)
{ {
LogError($" - {reason.Message}"); foreach (var reason in error.Reasons)
{
LogError($" - {reason.Message}");
}
} }
} }
} }