mirror of https://github.com/tuyoogame/YooAsset
update logger
parent
0bd5677e26
commit
93d7c34454
|
@ -2,23 +2,20 @@
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
public abstract class IYooLogger
|
/// 自定义日志处理
|
||||||
|
/// </summary>
|
||||||
|
public interface ILogger
|
||||||
{
|
{
|
||||||
public abstract void Info(string msg);
|
void Log(string message);
|
||||||
public abstract void Warning(string msg);
|
void Warning(string message);
|
||||||
|
void Error(string message);
|
||||||
public abstract void Error(string msg);
|
void Exception(System.Exception exception);
|
||||||
public abstract void Exception(System.Exception exception);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static class YooLogger
|
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)
|
if (Logger != null)
|
||||||
{
|
{
|
||||||
Logger.Info(info);
|
Logger.Log(info);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,13 +15,16 @@ namespace YooAsset
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 初始化资源系统
|
/// 初始化资源系统
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void Initialize()
|
/// <param name="logger">自定义日志处理</param>
|
||||||
|
public static void Initialize(ILogger logger = null)
|
||||||
{
|
{
|
||||||
if (_isInitialize)
|
if (_isInitialize)
|
||||||
throw new Exception($"{nameof(YooAssets)} is initialized !");
|
throw new Exception($"{nameof(YooAssets)} is initialized !");
|
||||||
|
|
||||||
if (_isInitialize == false)
|
if (_isInitialize == false)
|
||||||
{
|
{
|
||||||
|
YooLogger.Logger = logger;
|
||||||
|
|
||||||
// 创建驱动器
|
// 创建驱动器
|
||||||
_isInitialize = true;
|
_isInitialize = true;
|
||||||
_driver = new UnityEngine.GameObject($"[{nameof(YooAssets)}]");
|
_driver = new UnityEngine.GameObject($"[{nameof(YooAssets)}]");
|
||||||
|
@ -184,15 +187,6 @@ namespace YooAsset
|
||||||
DownloadSystem.CertificateHandlerInstance = instance;
|
DownloadSystem.CertificateHandlerInstance = instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 自定义日志处理
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="logger"></param>
|
|
||||||
public static void SetLogger(IYooLogger logger)
|
|
||||||
{
|
|
||||||
YooLogger.Logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置下载系统参数,自定义下载请求
|
/// 设置下载系统参数,自定义下载请求
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue