feat: Implement LogViewer control and integrate into EditPage
- Added LogViewer control to display log messages with filtering options. - Integrated LogViewer into EditPage for better log management. - Updated EngineEditorWindow to navigate to EditPage. - Enhanced Logger implementation for improved performance and stack trace capturing. - Introduced PathUtility for path normalization. - Refactored AssetManager to correct shader asset type naming. - Removed obsolete AssetHandlerRegistryTests and cleaned up related tests. - Updated ImportCoordinatorTests for streamlined asset import process.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Ghost.Core;
|
||||
|
||||
@@ -79,7 +80,7 @@ public static class Logger
|
||||
// TODO: Add file logging.
|
||||
private class LoggerImpl : ILogger
|
||||
{
|
||||
private readonly List<LogMessage> _logs = new List<LogMessage>();
|
||||
private readonly List<LogMessage> _logs = new List<LogMessage>(1024);
|
||||
private readonly Lock _lock = new Lock();
|
||||
|
||||
public IReadOnlyCollection<LogMessage> Logs => _logs;
|
||||
@@ -87,11 +88,12 @@ public static class Logger
|
||||
public bool CaptureStackTrace
|
||||
{
|
||||
get; set;
|
||||
} = true;
|
||||
}
|
||||
|
||||
public event Action<LogMessage>? OnLogAdded;
|
||||
public event Action? OnLogsCleared;
|
||||
|
||||
|
||||
[StackTraceHidden]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Log(string message, LogLevel level)
|
||||
|
||||
17
src/Runtime/Ghost.Core/Utilities/PathUtility.cs
Normal file
17
src/Runtime/Ghost.Core/Utilities/PathUtility.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ghost.Core.Utilities;
|
||||
|
||||
public static class PathUtility
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static string Normalize(string? path)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return Path.GetFullPath(path).TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ public enum AssetType
|
||||
Texture = 0,
|
||||
Mesh = 1,
|
||||
Material = 2,
|
||||
Shaders = 3,
|
||||
Shader = 3,
|
||||
Scene = 4,
|
||||
Audio = 5,
|
||||
Video = 6,
|
||||
|
||||
Reference in New Issue
Block a user