fix: normal logging when using webgl in editor
This commit is contained in:
parent
4610120329
commit
134c6f8923
@ -1,6 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
using log4net.Config;
|
||||||
using log4net.Core;
|
using log4net.Core;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Wraps Log4Net to only be used when not bein in a WebGL environment.
|
/// Wraps Log4Net to only be used when not bein in a WebGL environment.
|
||||||
@ -12,7 +15,7 @@ public static class LogManager
|
|||||||
|
|
||||||
public static log4net.ILog GetLogger(Type type)
|
public static log4net.ILog GetLogger(Type type)
|
||||||
{
|
{
|
||||||
#if !UNITY_WEBGL
|
#if !UNITY_WEBGL || UNITY_EDITOR
|
||||||
return log4net.LogManager.GetLogger(type);
|
return log4net.LogManager.GetLogger(type);
|
||||||
#else
|
#else
|
||||||
return new ConsoleLogger();
|
return new ConsoleLogger();
|
||||||
@ -21,13 +24,12 @@ public static class LogManager
|
|||||||
|
|
||||||
public static void ConfigureLogging()
|
public static void ConfigureLogging()
|
||||||
{
|
{
|
||||||
#if !UNITY_WEBGL
|
#if !UNITY_WEBGL || UNITY_EDITOR
|
||||||
log4net.GlobalContext.Properties["LogFileName"] = $"{Application.dataPath}" +
|
log4net.GlobalContext.Properties["LogFileName"] = $"{Application.dataPath}" +
|
||||||
"\\Logging\\SSOLog";
|
"\\Logging\\SSOLog";
|
||||||
var fi = new FileInfo($"{Application.dataPath}" +
|
var fi = new FileInfo($"{Application.dataPath}" +
|
||||||
"\\Logging\\Log4NetConfiguration.xml");
|
"\\Logging\\Log4NetConfiguration.xml");
|
||||||
XmlConfigurator.Configure(fi);
|
XmlConfigurator.Configure(fi);
|
||||||
Log.Debug("Log4Net configured.");
|
|
||||||
#else
|
#else
|
||||||
UnityEngine.Debug.Log("When using WebGL, logging is restricted to the console and unity's built in logger.");
|
UnityEngine.Debug.Log("When using WebGL, logging is restricted to the console and unity's built in logger.");
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user