using System.Diagnostics;
namespace YooAsset
{
///
/// 自定义日志处理
///
public interface ILogger
{
void Log(string message);
void Warning(string message);
void Error(string message);
void Exception(System.Exception exception);
}
internal static class YooLogger
{
public static ILogger Logger = null;
///
/// 日志
///
[Conditional("DEBUG")]
public static void Log(string info)
{
if (Logger != null)
{
Logger.Log(info);
}
else
{
UnityEngine.Debug.Log(info);
}
}
///
/// 警告
///
public static void Warning(string info)
{
if (Logger != null)
{
Logger.Warning(info);
}
else
{
UnityEngine.Debug.LogWarning(info);
}
}
///
/// 错误
///
public static void Error(string info)
{
if (Logger != null)
{
Logger.Error(info);
}
else
{
UnityEngine.Debug.LogError(info);
}
}
///
/// 异常
///
public static void Exception(System.Exception exception)
{
if (Logger != null)
{
Logger.Exception(exception);
}
else
{
UnityEngine.Debug.LogException(exception);
}
}
}
}