-
-
Save justonia/e3334d6d7ef4cca874a7c3a7a94fbcec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using log4net; | |
using log4net.Core; | |
using log4net.Config; | |
using log4net.Unity; | |
using log4net.Unity.Config; | |
using log4net.Layout; | |
using log4net.Repository.Hierarchy; | |
using UnityEngine; | |
using UnityEngine.Scripting; | |
using System; | |
[Preserve] | |
public class SunblinkSimpleConfigurator : IConfigurator | |
{ | |
public int Order { get; private set; } = -10; | |
public event Action OnChange; | |
public void TryConfigure() | |
{ | |
// log4uni hijacks unity log, f that. | |
Debug.unityLogger.logHandler = UnityDefaultLogHandler.DefaultUnityLogger; | |
var hierarchy = (Hierarchy)LogManager.GetRepository(); | |
var patternLayout = new PatternLayout(); | |
patternLayout.ConversionPattern = "[%thread][%level][%logger] %message"; | |
patternLayout.ActivateOptions(); | |
var appender = new UnityDefaultLogAppender(); | |
appender.Layout = patternLayout; | |
hierarchy.Root.AddAppender(appender); | |
hierarchy.Root.Level = Level.Info; | |
hierarchy.Configured = true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment