info level in log file

This commit is contained in:
Mikulas Florek 2019-07-09 13:56:11 +02:00
parent 76a7df84e9
commit 2b5f1a9fa1
7 changed files with 46 additions and 23 deletions

View File

@ -1,4 +1,4 @@
root = true
[*]
indent_style = tab
root = true
[*]
indent_style = tab

View File

@ -263,6 +263,8 @@ int AssetBrowser::getThumbnailIndex(int i, int j, int columns) const
void AssetBrowser::createTile(FileInfo& tile, const char* out_path)
{
if (tile.create_called) return;
logInfo("Editor") << "Creating tile for " << tile.filepath;
tile.create_called = true;
const AssetCompiler& compiler = m_app.getAssetCompiler();
for (IPlugin* plugin : m_plugins) {

View File

@ -464,6 +464,7 @@ struct AssetCompilerImpl : AssetCompiler
|| fs.getLastModified(dst_path) < fs.getLastModified(meta_path)
)
{
logInfo("Editor") << res.getPath() << " is not compiled, pushing to compile queue";
MT::SpinLock lock(m_to_compile_mutex);
MT::atomicIncrement(&m_task.m_to_compile_count);
const Path path(filepath);
@ -591,6 +592,7 @@ int AssetCompilerTask::task()
if (p.isValid()) {
PROFILE_BLOCK("compile asset");
Profiler::pushString(p.c_str());
logInfo("Editor") << "Compiling " << p << "...";
const bool compiled = m_compiler.compile(p);
MT::atomicDecrement(&m_to_compile_count);
if (compiled) {

View File

@ -266,6 +266,8 @@ public:
void onInit() override
{
OS::Timer init_timer;
m_add_cmp_root.label[0] = '\0';
m_template_name[0] = '\0';
m_open_filter[0] = '\0';
@ -284,7 +286,8 @@ public:
char data_dir[MAX_PATH_LENGTH] = {};
checkDataDirCommandLine(data_dir, lengthOf(data_dir));
m_engine = Engine::create(data_dir[0] ? data_dir : (saved_data_dir[0] ? saved_data_dir : current_dir), m_allocator);
m_engine = Engine::create(data_dir[0] ? data_dir : (saved_data_dir[0] ? saved_data_dir : current_dir)
, m_allocator);
createLua();
m_editor = WorldEditor::create(current_dir, *m_engine, m_allocator);
@ -327,6 +330,8 @@ public:
m_sleep_when_inactive = shouldSleepWhenInactive();
checkScriptCommandLine();
logInfo("Editor") << "Startup took " << init_timer.getTimeSinceStart() << " s";
}
@ -1589,6 +1594,7 @@ public:
void initIMGUI()
{
logInfo("Editor") << "Initializing imgui...";
ImGuiIO& io = ImGui::GetIO();
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard | ImGuiConfigFlags_DockingEnable;
io.IniFilename = nullptr;
@ -1653,6 +1659,7 @@ public:
void loadSettings()
{
logInfo("Editor") << "Loading settings...";
char cmd_line[2048];
OS::getCommandLine(cmd_line, lengthOf(cmd_line));
@ -1960,7 +1967,6 @@ public:
}
}
static void checkDataDirCommandLine(char* dir, int max_size)
{
char cmd_line[2048];
@ -2675,6 +2681,7 @@ public:
void loadIcons()
{
logInfo("Editor") << "Loading icons...";
RenderInterface& render_interface = *m_editor->getRenderInterface();
FileSystem& fs = m_engine->getFileSystem();
for (auto* action : m_actions)

View File

@ -2322,6 +2322,8 @@ public:
void doExecute(IEditorCommand* command)
{
ASSERT(command->isReady());
logInfo("Editor") << "Executing editor command " << command->getType() << "...";
m_is_universe_changed = true;
if (m_undo_index >= 0 && command->getType() == m_undo_stack[m_undo_index]->getType())
{
@ -2688,6 +2690,7 @@ public:
, m_game_mode_file(m_allocator)
, m_command_queue(m_allocator)
{
logInfo("Editor") << "Initializing editor...";
m_viewport.is_ortho = false;
m_viewport.pos = DVec3(0);
m_viewport.rot.set(0, 0, 0, 1);

View File

@ -389,8 +389,8 @@ void registerCFunction(lua_State* L, const char* name, lua_CFunction f)
static const u32 SERIALIZED_ENGINE_MAGIC = 0x5f4c454e; // == '_LEN'
static OS::OutputFile g_error_file;
static bool g_is_error_file_open = false;
static OS::OutputFile g_log_file;
static bool g_is_log_file_open = false;
#pragma pack(1)
@ -406,7 +406,7 @@ public:
static void showLogInVS(LogLevel level, const char* system, const char* message)
{
if(level == LogLevel::ERROR) {
Debug::debugOutput("error: ");
Debug::debugOutput("Error: ");
}
Debug::debugOutput(system);
Debug::debugOutput(" : ");
@ -417,10 +417,13 @@ static void showLogInVS(LogLevel level, const char* system, const char* message)
static void logToFile(LogLevel level, const char*, const char* message)
{
if (level != LogLevel::ERROR) return;
if (!g_is_error_file_open) return;
g_error_file.write(message, stringLength(message));
g_error_file.flush();
if (!g_is_log_file_open) return;
if (level == LogLevel::ERROR) {
g_log_file.write("Error: ", stringLength("Error :"));
}
g_log_file.write(message, stringLength(message));
g_log_file.write("\n", 1);
g_log_file.flush();
}
@ -466,12 +469,12 @@ public:
, m_paused(false)
, m_next_frame(false)
{
g_is_log_file_open = g_log_file.open("lumix.log");
logInfo("Core") << "Creating engine...";
Profiler::setThreadName("Worker");
installUnhandledExceptionHandler();
g_is_error_file_open = g_error_file.open("error.log");
getLogCallback().bind<logToFile>();
getLogCallback().bind<showLogInVS>();
@ -1210,7 +1213,7 @@ public:
m_prefab_resource_manager.destroy();
lua_close(m_state);
g_error_file.close();
g_log_file.close();
PathManager::destroy(*m_path_manager);
}

View File

@ -1,4 +1,5 @@
#include "engine/debug.h"
#include "engine/log.h"
#include "engine/mt/atomic.h"
#include "engine/os.h"
#include "engine/string.h"
@ -756,7 +757,7 @@ static LONG WINAPI unhandledExceptionHandler(LPEXCEPTION_POINTERS info)
};
auto dumper = [](void* data) -> DWORD {
auto info = ((CrashInfo*)data)->info;
LPEXCEPTION_POINTERS info = ((CrashInfo*)data)->info;
uintptr base = (uintptr)GetModuleHandle(NULL);
StaticString<4096> message;
if(info)
@ -798,12 +799,6 @@ static LONG WINAPI unhandledExceptionHandler(LPEXCEPTION_POINTERS info)
nullptr);
CloseHandle(file);
SendFile("Lumix Studio crash",
"SMTP:mikulas.florek@gamedev.sk",
"Lumix Studio",
message,
minidump_path);
minidump_type = (MINIDUMP_TYPE)(MiniDumpWithFullMemory | MiniDumpWithFullMemoryInfo |
MiniDumpFilterMemory | MiniDumpWithHandleData |
MiniDumpWithThreadInfo | MiniDumpWithUnloadedModules);
@ -816,7 +811,14 @@ static LONG WINAPI unhandledExceptionHandler(LPEXCEPTION_POINTERS info)
info ? &minidump_exception_info : nullptr,
nullptr,
nullptr);
CloseHandle(file);
SendFile("Lumix Studio crash",
"SMTP:mikulas.florek@gamedev.sk",
"Lumix Studio",
message,
minidump_path);
return 0;
};
@ -825,6 +827,10 @@ static LONG WINAPI unhandledExceptionHandler(LPEXCEPTION_POINTERS info)
auto handle = CreateThread(0, 0x8000, dumper, &crash_info, 0, &thread_id);
WaitForSingleObject(handle, INFINITE);
StaticString<4096> message;
getStack(*info->ContextRecord, message.data, sizeof(message.data));
logError("Engine") << message;
return EXCEPTION_CONTINUE_SEARCH;
}