添加了读日志
This commit is contained in:
parent
4469ebe8f4
commit
c37f276314
@ -44,6 +44,12 @@ namespace Plane.Logging
|
||||
}
|
||||
}
|
||||
|
||||
public override string ReadLog()
|
||||
{
|
||||
string text = File.ReadAllText(LogFilePath);
|
||||
return text;
|
||||
}
|
||||
|
||||
protected override void LogCore(string message, Category category, Priority priority)
|
||||
{
|
||||
lock (_logLock)
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Plane.Logging
|
||||
{
|
||||
@ -16,5 +17,11 @@ namespace Plane.Logging
|
||||
{
|
||||
Debug.WriteLine(BuildStandardLogEntry(message, category, priority)); //写入日志
|
||||
}
|
||||
|
||||
public override string ReadLog()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -18,5 +18,7 @@ namespace Plane.Logging
|
||||
/// <param name="category">Category of the entry.</param>
|
||||
/// <param name="priority">The priority of the entry.</param>
|
||||
void Log(string message, Category category = Category.Info, Priority priority = Priority.None);
|
||||
|
||||
string ReadLog();
|
||||
}
|
||||
}
|
@ -26,6 +26,9 @@ namespace Plane.Logging
|
||||
LogCore(message, category, priority);
|
||||
}
|
||||
|
||||
public abstract string ReadLog();
|
||||
|
||||
|
||||
protected static string BuildStandardLogEntry(string message, Category category, Priority priority)
|
||||
{
|
||||
return $"--{category}-{priority}-{DateTime.Now.ToString("yyyyMMdd HH:mm:ss.fff")}--------------------{Environment.NewLine}{Environment.NewLine}{message}{Environment.NewLine}{Environment.NewLine}--<END>--{Environment.NewLine}{Environment.NewLine}";
|
||||
|
Loading…
Reference in New Issue
Block a user