update logger
parent
0bd5677e26
commit
93d7c34454
|
@ -2,24 +2,21 @@
|
|||
|
||||
namespace YooAsset
|
||||
{
|
||||
|
||||
public abstract class IYooLogger
|
||||
/// <summary>
|
||||
/// 自定义日志处理
|
||||
/// </summary>
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// 自定义日志处理
|
||||
/// </summary>
|
||||
public static IYooLogger Logger = null;
|
||||
|
||||
/// <summary>
|
||||
/// 日志
|
||||
/// </summary>
|
||||
|
@ -28,7 +25,7 @@ namespace YooAsset
|
|||
{
|
||||
if (Logger != null)
|
||||
{
|
||||
Logger.Info(info);
|
||||
Logger.Log(info);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -15,13 +15,16 @@ namespace YooAsset
|
|||
/// <summary>
|
||||
/// 初始化资源系统
|
||||
/// </summary>
|
||||
public static void Initialize()
|
||||
/// <param name="logger">自定义日志处理</param>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 自定义日志处理
|
||||
/// </summary>
|
||||
/// <param name="logger"></param>
|
||||
public static void SetLogger(IYooLogger logger)
|
||||
{
|
||||
YooLogger.Logger = logger;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置下载系统参数,自定义下载请求
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue