diff --git a/Assets/YooAsset/Runtime/Utility/YooLogger.cs b/Assets/YooAsset/Runtime/Utility/YooLogger.cs
index 7668bc3..5962e95 100644
--- a/Assets/YooAsset/Runtime/Utility/YooLogger.cs
+++ b/Assets/YooAsset/Runtime/Utility/YooLogger.cs
@@ -2,24 +2,21 @@
namespace YooAsset
{
-
- public abstract class IYooLogger
+ ///
+ /// 自定义日志处理
+ ///
+ public interface ILogger
{
- 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);
+ 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;
- ///
- /// 自定义日志处理
- ///
- public static IYooLogger Logger = null;
-
///
/// 日志
///
@@ -28,7 +25,7 @@ namespace YooAsset
{
if (Logger != null)
{
- Logger.Info(info);
+ Logger.Log(info);
}
else
{
diff --git a/Assets/YooAsset/Runtime/YooAssets.cs b/Assets/YooAsset/Runtime/YooAssets.cs
index c47014c..619e7ef 100644
--- a/Assets/YooAsset/Runtime/YooAssets.cs
+++ b/Assets/YooAsset/Runtime/YooAssets.cs
@@ -15,13 +15,16 @@ namespace YooAsset
///
/// 初始化资源系统
///
- public static void Initialize()
+ /// 自定义日志处理
+ public static void Initialize(ILogger logger = null)
{
if (_isInitialize)
throw new Exception($"{nameof(YooAssets)} is initialized !");
if (_isInitialize == false)
{
+ YooLogger.Logger = logger;
+
// 创建驱动器
_isInitialize = true;
_driver = new UnityEngine.GameObject($"[{nameof(YooAssets)}]");
@@ -184,15 +187,6 @@ namespace YooAsset
DownloadSystem.CertificateHandlerInstance = instance;
}
- ///
- /// 自定义日志处理
- ///
- ///
- public static void SetLogger(IYooLogger logger)
- {
- YooLogger.Logger = logger;
- }
-
///
/// 设置下载系统参数,自定义下载请求
///