using Axibug;
using System;
using UnityEngine;
namespace Axibug.Runtime
{
public sealed partial class DebuggerComponent : GameComponent
{
///
/// 日志记录结点。
///
public sealed class LogNode : IReference
{
private DateTime m_LogTime;
private int m_LogFrameCount;
private LogType m_LogType;
private string m_LogMessage;
private string m_StackTrack;
///
/// 初始化日志记录结点的新实例。
///
public LogNode()
{
m_LogTime = default(DateTime);
m_LogFrameCount = 0;
m_LogType = LogType.Error;
m_LogMessage = null;
m_StackTrack = null;
}
///
/// 获取日志时间。
///
public DateTime LogTime
{
get
{
return m_LogTime;
}
}
///
/// 获取日志帧计数。
///
public int LogFrameCount
{
get
{
return m_LogFrameCount;
}
}
///
/// 获取日志类型。
///
public LogType LogType
{
get
{
return m_LogType;
}
}
///
/// 获取日志内容。
///
public string LogMessage
{
get
{
return m_LogMessage;
}
}
///
/// 获取日志堆栈信息。
///
public string StackTrack
{
get
{
return m_StackTrack;
}
}
///
/// 创建日志记录结点。
///
/// 日志类型。
/// 日志内容。
/// 日志堆栈信息。
/// 创建的日志记录结点。
public static LogNode Create(LogType logType, string logMessage, string stackTrack)
{
LogNode logNode = ReferencePool.Acquire();
logNode.m_LogTime = DateTime.UtcNow;
logNode.m_LogFrameCount = Time.frameCount;
logNode.m_LogType = logType;
logNode.m_LogMessage = logMessage;
logNode.m_StackTrack = stackTrack;
return logNode;
}
///
/// 清理日志记录结点。
///
public void Clear()
{
m_LogTime = default(DateTime);
m_LogFrameCount = 0;
m_LogType = LogType.Error;
m_LogMessage = null;
m_StackTrack = null;
}
}
}
}