Unify inspector and console panel actions
This commit is contained in:
@@ -1,43 +1,14 @@
|
||||
#include "Application.h"
|
||||
#include "Core/EditorLoggingSetup.h"
|
||||
#include "Core/EditorWindowTitle.h"
|
||||
#include "Layers/EditorLayer.h"
|
||||
#include "Core/EditorContext.h"
|
||||
#include "Core/EditorConsoleSink.h"
|
||||
#include "Core/EditorEvents.h"
|
||||
#include "Core/EventBus.h"
|
||||
#include "Platform/Win32Utf8.h"
|
||||
#include <XCEngine/Debug/Logger.h>
|
||||
#include <XCEngine/Debug/FileLogSink.h>
|
||||
#include <XCEngine/Debug/ConsoleLogSink.h>
|
||||
#include <stdio.h>
|
||||
#include "Platform/WindowsProcessDiagnostics.h"
|
||||
#include <windows.h>
|
||||
|
||||
namespace {
|
||||
std::string GetExecutableLogPath(const char* fileName) {
|
||||
return XCEngine::Editor::Platform::GetExecutableDirectoryUtf8() + "\\" + fileName;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
static LONG WINAPI GlobalExceptionFilter(EXCEPTION_POINTERS* exceptionPointers) {
|
||||
const std::string logPath = GetExecutableLogPath("crash.log");
|
||||
|
||||
FILE* f = nullptr;
|
||||
fopen_s(&f, logPath.c_str(), "a");
|
||||
if (f) {
|
||||
fprintf(f, "[CRASH] ExceptionCode=0x%08X, Address=0x%p\n",
|
||||
exceptionPointers->ExceptionRecord->ExceptionCode,
|
||||
exceptionPointers->ExceptionRecord->ExceptionAddress);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
fprintf(stderr, "[CRASH] ExceptionCode=0x%08X, Address=0x%p\n",
|
||||
exceptionPointers->ExceptionRecord->ExceptionCode,
|
||||
exceptionPointers->ExceptionRecord->ExceptionAddress);
|
||||
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
}
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Editor {
|
||||
|
||||
@@ -47,21 +18,11 @@ Application& Application::Get() {
|
||||
}
|
||||
|
||||
bool Application::Initialize(HWND hwnd) {
|
||||
SetUnhandledExceptionFilter(GlobalExceptionFilter);
|
||||
|
||||
{
|
||||
const std::string stderrPath = GetExecutableLogPath("stderr.log");
|
||||
freopen(stderrPath.c_str(), "w", stderr);
|
||||
}
|
||||
|
||||
Debug::Logger::Get().AddSink(std::make_unique<Debug::ConsoleLogSink>());
|
||||
Debug::Logger::Get().AddSink(std::make_unique<Debug::EditorConsoleSink>());
|
||||
Platform::InstallCrashExceptionFilter();
|
||||
Platform::RedirectStderrToExecutableLog();
|
||||
|
||||
const std::string exeDir = Platform::GetExecutableDirectoryUtf8();
|
||||
std::string logPath = exeDir + "\\editor.log";
|
||||
Debug::Logger::Get().AddSink(std::make_unique<Debug::FileLogSink>(logPath.c_str()));
|
||||
Debug::Logger::Get().Info(Debug::LogCategory::General, "Editor Application starting...");
|
||||
Debug::Logger::Get().Info(Debug::LogCategory::General, ("Log file: " + logPath).c_str());
|
||||
ConfigureEditorLogging(exeDir);
|
||||
|
||||
m_hwnd = hwnd;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user