diff --git a/Assets/YooAsset/Runtime/Utility/YooLogger.cs b/Assets/YooAsset/Runtime/Utility/YooLogger.cs
index c148a85..7668bc3 100644
--- a/Assets/YooAsset/Runtime/Utility/YooLogger.cs
+++ b/Assets/YooAsset/Runtime/Utility/YooLogger.cs
@@ -2,15 +2,38 @@
namespace YooAsset
{
+
+ public abstract class IYooLogger
+ {
+ public abstract void Info(string msg);
+ public abstract void Warning(string msg);
+
+ public abstract void Error(string msg);
+ public abstract void Exception(System.Exception exception);
+ }
+
internal static class YooLogger
{
+
+ ///
+ /// 自定义日志处理
+ ///
+ public static IYooLogger Logger = null;
+
///
/// 日志
///
[Conditional("DEBUG")]
public static void Log(string info)
{
- UnityEngine.Debug.Log(info);
+ if (Logger != null)
+ {
+ Logger.Info(info);
+ }
+ else
+ {
+ UnityEngine.Debug.Log(info);
+ }
}
///
@@ -18,7 +41,14 @@ namespace YooAsset
///
public static void Warning(string info)
{
- UnityEngine.Debug.LogWarning(info);
+ if (Logger != null)
+ {
+ Logger.Warning(info);
+ }
+ else
+ {
+ UnityEngine.Debug.LogWarning(info);
+ }
}
///
@@ -26,7 +56,14 @@ namespace YooAsset
///
public static void Error(string info)
{
- UnityEngine.Debug.LogError(info);
+ if (Logger != null)
+ {
+ Logger.Error(info);
+ }
+ else
+ {
+ UnityEngine.Debug.LogError(info);
+ }
}
///
@@ -34,7 +71,14 @@ namespace YooAsset
///
public static void Exception(System.Exception exception)
{
- UnityEngine.Debug.LogException(exception);
+ if (Logger != null)
+ {
+ Logger.Exception(exception);
+ }
+ else
+ {
+ UnityEngine.Debug.LogException(exception);
+ }
}
}
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/YooAssets.cs b/Assets/YooAsset/Runtime/YooAssets.cs
index 9b5a5f4..c47014c 100644
--- a/Assets/YooAsset/Runtime/YooAssets.cs
+++ b/Assets/YooAsset/Runtime/YooAssets.cs
@@ -184,6 +184,15 @@ namespace YooAsset
DownloadSystem.CertificateHandlerInstance = instance;
}
+ ///
+ /// 自定义日志处理
+ ///
+ ///
+ public static void SetLogger(IYooLogger logger)
+ {
+ YooLogger.Logger = logger;
+ }
+
///
/// 设置下载系统参数,自定义下载请求
///