using log4net.Appender; using log4net.Core; using UnityEngine; public class UnityDebugAppender : AppenderSkeleton { protected override void Append(LoggingEvent loggingEvent) { string message = RenderLoggingEvent(loggingEvent); string colorTag = GetColorTag(loggingEvent.Level); Debug.Log($"{colorTag} {message}"); } private string GetColorTag(Level level) { // Map log levels to colors (customize as needed) switch (level.Name) { case "DEBUG": return "Debug: "; case "INFO": return @"Info: "; case "WARN": return @"Warning: "; case "ERROR": return @"Error: "; default: return ""; } } }