diff options
author | chai <chaifix@163.com> | 2021-11-01 12:10:29 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-11-01 12:10:29 +0800 |
commit | 44d6c41e5e586572de08c72c358aed9100a30353 (patch) | |
tree | a3dee8cbb9f7181c88464b31f231a264c570acd4 | |
parent | 78417f6cdedfcf60c8ca437190975644e942e01f (diff) |
*log
-rw-r--r-- | Editor/EditorMain.cpp | 4 | ||||
-rw-r--r-- | Editor/GUI/ContainerWindow.cpp | 10 | ||||
-rw-r--r-- | Editor/GUI/GUIWindow.cpp | 12 | ||||
-rw-r--r-- | Editor/GUI/MenuManager.cpp | 6 | ||||
-rw-r--r-- | Editor/Scripting/Editor/Editor.bind.cpp | 2 | ||||
-rw-r--r-- | Editor/Scripting/EditorGUI/EditorGUI.bind.cpp | 2 | ||||
-rw-r--r-- | Editor/Scripting/EditorScripting.cpp | 2 | ||||
-rw-r--r-- | Projects/VisualStudio/GameLab.sln | 20 | ||||
-rw-r--r-- | Runtime/Debug/Log.cpp | 164 | ||||
-rw-r--r-- | Runtime/Debug/Log.h | 16 | ||||
-rw-r--r-- | Runtime/Graphics/DynamicVertexBuffer.h | 1 | ||||
-rw-r--r-- | Runtime/Graphics/VertexBuffer.h | 7 | ||||
-rw-r--r-- | Runtime/Scripting/Debug/Debug.bind.cpp | 10 | ||||
-rw-r--r-- | Runtime/Scripting/GL/GL.bind.cpp | 2 | ||||
-rw-r--r-- | Runtime/Scripting/IO/IO.bind.cpp | 6 | ||||
-rw-r--r-- | Runtime/Scripting/Rendering/Rendering.bind.cpp | 2 | ||||
-rw-r--r-- | Runtime/Scripting/Resource/Resource.bind.cpp | 2 |
17 files changed, 145 insertions, 123 deletions
diff --git a/Editor/EditorMain.cpp b/Editor/EditorMain.cpp index 289eed4..45ac81a 100644 --- a/Editor/EditorMain.cpp +++ b/Editor/EditorMain.cpp @@ -15,7 +15,7 @@ using namespace LuaBind; void ErrorHandle(cc8* msg)
{
- log_error(std::string("[Lua] ") + msg);
+ log_error("[Lua] %s", msg);
}
void TestFont()
@@ -68,6 +68,8 @@ int main() int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) #endif {
+ log_info("log_info_c test, %s %d", "hello", 3);
+
WindowUtil::RegisterClasses();
LuaBind::VM vm;
diff --git a/Editor/GUI/ContainerWindow.cpp b/Editor/GUI/ContainerWindow.cpp index 01bb1e9..d737838 100644 --- a/Editor/GUI/ContainerWindow.cpp +++ b/Editor/GUI/ContainerWindow.cpp @@ -24,7 +24,7 @@ LRESULT CALLBACK ContainerWindow::ContainerWndProc(HWND hWnd, UINT message, WPAR return DefWindowProcW(hWnd, message, wParam, lParam); } - //log_info("WndProc", "ContainerWindow::ContainerWndProc(), ContainerWindow name is " + self->GetName()); + //log_info_tag("WndProc", "ContainerWindow::ContainerWndProc(), ContainerWindow name is " + self->GetName()); switch (message) { @@ -412,16 +412,16 @@ void ContainerWindow::SetIcon(LPCSTR iconName) HICON hWindowIcon = (HICON )LoadImage(winutils::GetInstanceHandle(), iconName, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_LOADFROMFILE); if (hWindowIcon == NULL) - log_error("icon error: " + to_string(GetLastError())); + log_error("icon error: %lu", GetLastError()); if (SendMessage(m_Window, WM_SETICON, ICON_BIG, (LPARAM)hWindowIcon) != WM_SETICON) - log_error("icon error: " + to_string(GetLastError())); + log_error("icon error: %lu", GetLastError()); if (SendMessage(m_Window, WM_SETICON, ICON_SMALL, (LPARAM)hWindowIcon) != WM_SETICON) - log_error("icon error: " + to_string(GetLastError())); + log_error("icon error: %lu", GetLastError()); } void ContainerWindow::Close() { - log_info("Close window " + m_Name); + log_info("Close window %s", m_Name); SendMessage(m_Window, WM_CLOSE, 0, 0); } diff --git a/Editor/GUI/GUIWindow.cpp b/Editor/GUI/GUIWindow.cpp index eb44647..011dfa8 100644 --- a/Editor/GUI/GUIWindow.cpp +++ b/Editor/GUI/GUIWindow.cpp @@ -34,7 +34,7 @@ LRESULT CALLBACK GUIWindow::GUIViewWndProc(HWND hWnd, UINT message, WPARAM wPara return DefWindowProcW(hWnd, message, wParam, lParam); } - //log_info("WndProc", "GUIWindow::GUIViewWndProc(), GUIWindow name is " + wnd->GetName()); + //log_info_tag("WndProc", "GUIWindow::GUIViewWndProc(), GUIWindow name is %s", self->GetName()); switch (message) { @@ -44,7 +44,7 @@ LRESULT CALLBACK GUIWindow::GUIViewWndProc(HWND hWnd, UINT message, WPARAM wPara case WM_PAINT: { - log_info("WndProc", "WM_PAINT"); + log_info_tag("WndProc", "WM_PAINT"); self->SetAsRenderContext(); self->OnPaint(); @@ -57,7 +57,7 @@ LRESULT CALLBACK GUIWindow::GUIViewWndProc(HWND hWnd, UINT message, WPARAM wPara case WM_MOUSEWHEEL: // 在这个子窗口滚动 { - log_info("WndProc","WM_MOUSEWHEEL"); + log_info_tag("WndProc","WM_MOUSEWHEEL"); // quick check if mouse is in our window RECT rc; @@ -193,7 +193,7 @@ void GUIWindow::ProcessEventMessages(UINT message, WPARAM wParam, LPARAM lParam) void GUIWindow::Init(std::string name) { - log_info("Init GUIWindow " /*+ (long)this*/); + log_info("Init GUIWindow"); m_Name = name; @@ -237,7 +237,7 @@ void GUIWindow::Init(std::string name) if (!bRC) log_error("Failed to setup rendering context"); - log_info("Created GUIWindow " /*+ (long)this*/); + log_info("Created GUIWindow "); } bool GUIWindow::SetRenderContext() @@ -338,7 +338,7 @@ void GUIWindow::SetAsRenderContext() void GUIWindow::Focus() { - log_info("Focus GUIWindow " + (long)this); + log_info("Focus GUIWindow "); if (m_Handle) { if (::GetForegroundWindow() != m_ContainerWindow->GetWindowHandle()) diff --git a/Editor/GUI/MenuManager.cpp b/Editor/GUI/MenuManager.cpp index c0fc989..1ba35fd 100644 --- a/Editor/GUI/MenuManager.cpp +++ b/Editor/GUI/MenuManager.cpp @@ -45,17 +45,17 @@ void MenuManager::Init() void MenuManager::AddMenuItem(std::string name, int order) { - log_info("Menu", " Add menu item \"" + name + "\""); + log_info_tag("Menu", " Add menu item \"%s\"", name); } void MenuManager::HandleMenuItemEvent(HMENU menu, unsigned int menuId, unsigned int flags) { - log_info("Menu", "menuId=" + to_string(menuId) + ", flags=" + to_string(flags)); + log_info_tag("Menu", "menuId=%d, flags=%d",menuId, flags); if (flags & MF_CHECKED) // clicked { - log_info("Menu", "checked"); + log_info_tag("Menu", "checked"); } }
\ No newline at end of file diff --git a/Editor/Scripting/Editor/Editor.bind.cpp b/Editor/Scripting/Editor/Editor.bind.cpp index 9808141..99db0b2 100644 --- a/Editor/Scripting/Editor/Editor.bind.cpp +++ b/Editor/Scripting/Editor/Editor.bind.cpp @@ -3,7 +3,7 @@ // GameLab.Editor int luaopen_GameLab_Editor(lua_State* L) { - log_info("Scripting", "luaopen_GameLab_Editor()"); + log_info_tag("Scripting", "luaopen_GameLab_Editor()"); LUA_BIND_STATE(L); diff --git a/Editor/Scripting/EditorGUI/EditorGUI.bind.cpp b/Editor/Scripting/EditorGUI/EditorGUI.bind.cpp index 2fea6be..dc7b88c 100644 --- a/Editor/Scripting/EditorGUI/EditorGUI.bind.cpp +++ b/Editor/Scripting/EditorGUI/EditorGUI.bind.cpp @@ -3,7 +3,7 @@ // GameLab.Editor.GUI int luaopen_GameLab_Editor_GUI(lua_State* L) { - log_info("Scripting", "luaopen_GameLab_Editor_GUI()"); + log_info_tag("Scripting", "luaopen_GameLab_Editor_GUI()"); LUA_BIND_STATE(L); diff --git a/Editor/Scripting/EditorScripting.cpp b/Editor/Scripting/EditorScripting.cpp index f384248..43ed666 100644 --- a/Editor/Scripting/EditorScripting.cpp +++ b/Editor/Scripting/EditorScripting.cpp @@ -34,7 +34,7 @@ extern int luaopen_GameLab_Editor_Scripting(lua_State* L); // GameLab.Editor.Scr bool SetupGameLabEditorScripting(lua_State* L) { - log_info("Scripting", "SetupGameLabEditorScripting()"); + log_info_tag("Scripting", "SetupGameLabEditorScripting()"); openlib(luaopen_GameLab); diff --git a/Projects/VisualStudio/GameLab.sln b/Projects/VisualStudio/GameLab.sln index 9a7496c..8013406 100644 --- a/Projects/VisualStudio/GameLab.sln +++ b/Projects/VisualStudio/GameLab.sln @@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15
VisualStudioVersion = 15.0.28307.1022
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Runtime", "Runtime\Runtime.vcxproj", "{4C26BDCC-CA08-4C43-8EFF-B62A204D5FBD}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2", "SDL2\SDL2.vcxproj", "{8658F91C-9AAE-4819-9005-77D09C61D97F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ThirdParty", "ThirdParty", "{0F6EE105-E1FF-4770-8314-06F9F98FB68F}"
@@ -31,6 +29,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AsyncTask", "AsyncTask\Asyn EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hash-library", "hash-library\hash-library.vcxproj", "{F5341260-AFF4-4F99-9182-C8A0673E3B14}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Runner", "Runner\Runner.vcxproj", "{0168C539-D3F8-48AD-BBB0-259B87786D1F}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@@ -39,14 +39,6 @@ Global Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {4C26BDCC-CA08-4C43-8EFF-B62A204D5FBD}.Debug|x64.ActiveCfg = Debug|x64
- {4C26BDCC-CA08-4C43-8EFF-B62A204D5FBD}.Debug|x64.Build.0 = Debug|x64
- {4C26BDCC-CA08-4C43-8EFF-B62A204D5FBD}.Debug|x86.ActiveCfg = Debug|Win32
- {4C26BDCC-CA08-4C43-8EFF-B62A204D5FBD}.Debug|x86.Build.0 = Debug|Win32
- {4C26BDCC-CA08-4C43-8EFF-B62A204D5FBD}.Release|x64.ActiveCfg = Release|x64
- {4C26BDCC-CA08-4C43-8EFF-B62A204D5FBD}.Release|x64.Build.0 = Release|x64
- {4C26BDCC-CA08-4C43-8EFF-B62A204D5FBD}.Release|x86.ActiveCfg = Release|Win32
- {4C26BDCC-CA08-4C43-8EFF-B62A204D5FBD}.Release|x86.Build.0 = Release|Win32
{8658F91C-9AAE-4819-9005-77D09C61D97F}.Debug|x64.ActiveCfg = Debug|x64
{8658F91C-9AAE-4819-9005-77D09C61D97F}.Debug|x64.Build.0 = Debug|x64
{8658F91C-9AAE-4819-9005-77D09C61D97F}.Debug|x86.ActiveCfg = Debug|Win32
@@ -135,6 +127,14 @@ Global {F5341260-AFF4-4F99-9182-C8A0673E3B14}.Release|x64.Build.0 = Release|x64
{F5341260-AFF4-4F99-9182-C8A0673E3B14}.Release|x86.ActiveCfg = Release|Win32
{F5341260-AFF4-4F99-9182-C8A0673E3B14}.Release|x86.Build.0 = Release|Win32
+ {0168C539-D3F8-48AD-BBB0-259B87786D1F}.Debug|x64.ActiveCfg = Debug|x64
+ {0168C539-D3F8-48AD-BBB0-259B87786D1F}.Debug|x64.Build.0 = Debug|x64
+ {0168C539-D3F8-48AD-BBB0-259B87786D1F}.Debug|x86.ActiveCfg = Debug|Win32
+ {0168C539-D3F8-48AD-BBB0-259B87786D1F}.Debug|x86.Build.0 = Debug|Win32
+ {0168C539-D3F8-48AD-BBB0-259B87786D1F}.Release|x64.ActiveCfg = Release|x64
+ {0168C539-D3F8-48AD-BBB0-259B87786D1F}.Release|x64.Build.0 = Release|x64
+ {0168C539-D3F8-48AD-BBB0-259B87786D1F}.Release|x86.ActiveCfg = Release|Win32
+ {0168C539-D3F8-48AD-BBB0-259B87786D1F}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Runtime/Debug/Log.cpp b/Runtime/Debug/Log.cpp index c92bdc8..c44d7af 100644 --- a/Runtime/Debug/Log.cpp +++ b/Runtime/Debug/Log.cpp @@ -3,6 +3,7 @@ #include <iostream> #include <ctime> #include <unordered_set> +#include <stdarg.h> using namespace std; @@ -30,105 +31,124 @@ const std::string currentDateTime() { return buf; } -void log_open_tag(std::string tag) -{ - s_OpenTags.insert(tag); +static void SetOutputColor(int i) { + if (s_ConsoleHandle == 0) { + s_ConsoleHandle = GetStdHandle(STD_OUTPUT_HANDLE); + } + if (i == 0) { + SetConsoleTextAttribute(s_ConsoleHandle, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY); + } + else if(i == 1) { + SetConsoleTextAttribute(s_ConsoleHandle, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY); + } + else { + SetConsoleTextAttribute(s_ConsoleHandle, FOREGROUND_RED | FOREGROUND_INTENSITY); + } } -// https://stackoverflow.com/questions/4053837/colorizing-text-in-the-console-with-c -// https://en.wikipedia.org/wiki/ANSI_escape_code#Windows_and_DOS -// https://stackoverflow.com/questions/9262270/color-console-output-with-c-in-windows -// https://blog.csdn.net/odaynot/article/details/7722240 - -void log_info(std::string log) +void log_error_null_param(const char* funcName, const char* param) { - Lock(s_Mutex) { -#ifdef GAMELAB_WIN - if (s_ConsoleHandle == 0) { - s_ConsoleHandle = GetStdHandle(STD_OUTPUT_HANDLE); - } - SetConsoleTextAttribute(s_ConsoleHandle, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY); - cout << currentDateTime() << " [Info] " << log << endl; -#else - cout << "\x1B[97m" << currentDateTime() << " [Info] " << log << "\x1B[0m" << endl; -#endif - } -} - -void log_warning(std::string log) -{ - Lock(s_Mutex) { -#ifdef GAMELAB_WIN - if (s_ConsoleHandle == 0) { - s_ConsoleHandle = GetStdHandle(STD_OUTPUT_HANDLE); - } - SetConsoleTextAttribute(s_ConsoleHandle, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY); - cout << currentDateTime() << " [Warning] " << log << endl; -#else - cout << "\x1B[93m" << currentDateTime() << " [Warning] " << log << "\x1B[0m" << endl; -#endif - } + log_error("Null parameter in %s called %s", funcName, param); } -void log_error(std::string log) +void log_open_tag(const char* tag) { - Lock(s_Mutex) { -#ifdef GAMELAB_WIN - if (s_ConsoleHandle == 0) { - s_ConsoleHandle = GetStdHandle(STD_OUTPUT_HANDLE); - } - SetConsoleTextAttribute(s_ConsoleHandle, FOREGROUND_RED | FOREGROUND_INTENSITY); - cout << currentDateTime() << " [Error] " << log << endl; -#else - cout << "\x1B[91m" << currentDateTime() << " [Error] " << log << "\x1B[0m" << endl; -#endif - } + s_OpenTags.insert(tag); } -void log_error_null_param(std::string funcName, std::string param) +void log_info(const char* fmt, ...) { - log_error("Null parameter in " + funcName + " called " + param); + Lock(s_Mutex) { + SetOutputColor(0); + va_list pArgs = NULL;
+ va_start(pArgs, fmt); + printf("%s [Info] ", currentDateTime().c_str()); + vprintf(fmt, pArgs); + printf("\n"); + va_end(pArgs);
+ }
} -void log_info(string tag, std::string log) +void log_warning(const char* fmt, ...) { - if (s_OpenTags.count(tag) <= 0) - return; - log_info("[" + tag + "] " + log); + Lock(s_Mutex) { + SetOutputColor(1); + va_list pArgs = NULL;
+ va_start(pArgs, fmt); + printf("%s [Warning] ", currentDateTime().c_str()); + vprintf(fmt, pArgs); + printf("\n"); + va_end(pArgs);
+ }
} -void log_warning(string tag, std::string log) -{ - if (s_OpenTags.count(tag) <= 0) - return; - log_warning("[" + tag + "] " + log); -} -void log_error(string tag, std::string log) -{ - if (s_OpenTags.count(tag) <= 0) - return; - log_error("[" + tag + "] " + log); -} -#else -void log_open_tag(std::string tag) {} -void log_info(std::string log) +void log_error(const char* fmt, ...) { + Lock(s_Mutex) { + SetOutputColor(2); + va_list pArgs = NULL;
+ va_start(pArgs, fmt); + printf("%s [Error] ", currentDateTime().c_str()); + vprintf(fmt, pArgs); + printf("\n"); + va_end(pArgs);
+ }
} -void log_warning(std::string log) +void log_info_tag(const char* tag, const char* fmt, ...) { + Lock(s_Mutex) { + SetOutputColor(0); + va_list pArgs = NULL;
+ va_start(pArgs, fmt); + printf("%s [Info] %s ", currentDateTime().c_str(), tag); + vprintf(fmt, pArgs); + printf("\n"); + va_end(pArgs);
+ } } -void log_error(std::string log) +void log_warning_tag(const char* tag, const char* fmt, ...) { + Lock(s_Mutex) { + SetOutputColor(1); + va_list pArgs = NULL;
+ va_start(pArgs, fmt); + printf("%s [Warning] %s ", currentDateTime().c_str(), tag); + vprintf(fmt, pArgs); + printf("\n"); + va_end(pArgs);
+ } } -void log_error_null_param(std::string funcName, std::string param) +void log_error_tag(const char* tag, const char* fmt, ...) { + Lock(s_Mutex) { + SetOutputColor(2); + va_list pArgs = NULL;
+ va_start(pArgs, fmt); + printf("%s [Error] %s ", currentDateTime().c_str(), tag); + vprintf(fmt, pArgs); + printf("\n"); + va_end(pArgs);
+ } } +#else +void log_open_tag(std::string tag) {} +void log_info(std::string log) {} +void log_warning(std::string log){} +void log_error(std::string log){} +void log_error_null_param(std::string funcName, std::string param){} void log_info(string tag, std::string log) {} void log_warning(string tag, std::string log) {} void log_error(string tag, std::string log) {} -#endif
\ No newline at end of file +void log_open_tag(const char* tag) {} +void log_info(const char* log, ...) {} +void log_warning(const char* log, ...) {} +void log_error(const char* log, ...) {} +void log_info(const char* tag, const char* log, ...) {} +void log_warning(const char* tag, const char* log, ...) {} +void log_error(const char* tag, const char* log, ...) {} +#endif
\ No newline at end of file diff --git a/Runtime/Debug/Log.h b/Runtime/Debug/Log.h index aaaaa78..8547102 100644 --- a/Runtime/Debug/Log.h +++ b/Runtime/Debug/Log.h @@ -1,14 +1,14 @@ #pragma once #include <string> -void log_open_tag(std::string tag); +void log_open_tag(const char* tag); -void log_info(std::string log); -void log_warning(std::string log); -void log_error(std::string log); +void log_info(const char* fmt, ...); +void log_warning(const char* fmt, ...); +void log_error(const char* fmt, ...); -void log_error_null_param(std::string funcName, std::string param); +void log_error_null_param(const char* funcName, const char* param); -void log_info(std::string tag, std::string log); -void log_warning(std::string tag, std::string log); -void log_error(std::string tag, std::string log); +void log_info_tag(const char* tag, const char* fmt, ...); +void log_warning_tag(const char* tag, const char* fmt, ...); +void log_error_tag(const char* tag, const char* fmt, ...); diff --git a/Runtime/Graphics/DynamicVertexBuffer.h b/Runtime/Graphics/DynamicVertexBuffer.h index a849f4c..b520d1b 100644 --- a/Runtime/Graphics/DynamicVertexBuffer.h +++ b/Runtime/Graphics/DynamicVertexBuffer.h @@ -10,6 +10,7 @@ #include "CustomVertexLayout.h" #include "Primitive.h" +// 动态填充的VBO class DynamicVertexBuffer { public: diff --git a/Runtime/Graphics/VertexBuffer.h b/Runtime/Graphics/VertexBuffer.h index 5e4fdf2..e6fd9ee 100644 --- a/Runtime/Graphics/VertexBuffer.h +++ b/Runtime/Graphics/VertexBuffer.h @@ -1,5 +1,4 @@ -#ifndef VBO_H -#define VBO_H +#pragma once #include <vector> @@ -31,8 +30,8 @@ public: private: VertexBufferType m_Type; + GPU::DataBuffer* m_VB; GPU::DataBuffer* m_IB; -}; -#endif
\ No newline at end of file +}; diff --git a/Runtime/Scripting/Debug/Debug.bind.cpp b/Runtime/Scripting/Debug/Debug.bind.cpp index 9d98211..275f935 100644 --- a/Runtime/Scripting/Debug/Debug.bind.cpp +++ b/Runtime/Scripting/Debug/Debug.bind.cpp @@ -14,7 +14,7 @@ int log(lua_State* L) { const char* tag = state.GetValue<const char*>(-2, ""); const char* msg = state.GetValue<const char*>(-1, ""); - log_info(tag, msg); + log_warning_tag(tag, msg); } else { @@ -36,7 +36,7 @@ int logWwarning(lua_State* L) { const char* tag = state.GetValue<const char*>(-2, ""); const char* msg = state.GetValue<const char*>(-1, ""); - log_warning(tag, msg); + log_warning_tag(tag, msg); } else { @@ -58,7 +58,7 @@ int logError(lua_State* L) { const char* tag = state.GetValue<const char*>(-2, ""); const char* msg = state.GetValue<const char*>(-1, ""); - log_error(tag, msg); + log_error_tag(tag, msg); } else { @@ -81,7 +81,7 @@ int logEditor(lua_State* L) { const char* tag = state.GetValue<const char*>(-2, ""); const char* msg = state.GetValue<const char*>(-1, ""); - log_info(tag, msg); + log_info_tag(tag, msg); } else { @@ -103,7 +103,7 @@ int openTag(lua_State* L) int luaopen_GameLab_Debug(lua_State* L) { - log_info("Scripting", "luaopen_GameLab_Debug()"); + log_info_tag("Scripting", "luaopen_GameLab_Debug()"); LUA_BIND_STATE(L); diff --git a/Runtime/Scripting/GL/GL.bind.cpp b/Runtime/Scripting/GL/GL.bind.cpp index 40093e9..f2a270b 100644 --- a/Runtime/Scripting/GL/GL.bind.cpp +++ b/Runtime/Scripting/GL/GL.bind.cpp @@ -421,7 +421,7 @@ static luaL_Reg glFuncs[] = { // GameLab.Engine.GL int luaopen_GameLab_Engine_GL(lua_State* L) { - log_info("Scripting", "luaopen_GameLab_Engine_GL()"); + log_info_tag("Scripting", "luaopen_GameLab_Engine_GL()"); LUA_BIND_STATE(L); diff --git a/Runtime/Scripting/IO/IO.bind.cpp b/Runtime/Scripting/IO/IO.bind.cpp index a46b110..f9530a2 100644 --- a/Runtime/Scripting/IO/IO.bind.cpp +++ b/Runtime/Scripting/IO/IO.bind.cpp @@ -62,7 +62,7 @@ int ReadFile(lua_State* L) std::ifstream file = ifstream(path, openMode); if (!file.is_open()) { - log_error(string("Can't read file. ") + path); + log_error("Can't read file. %s", path); state.PushNil(); return 1; } @@ -72,7 +72,7 @@ int ReadFile(lua_State* L) size = file.tellg() - size; if (size == 0) { - log_error(string("File is Empty. ") + path); + log_error("File is Empty. %s", path); state.PushNil(); return 1; } @@ -106,7 +106,7 @@ static luaL_Reg ioFuncs[] = { int luaopen_GameLab_IO(lua_State* L) { - log_info("Scripting", "luaopen_GameLab_IO()"); + log_info_tag("Scripting", "luaopen_GameLab_IO()"); LUA_BIND_STATE(L); diff --git a/Runtime/Scripting/Rendering/Rendering.bind.cpp b/Runtime/Scripting/Rendering/Rendering.bind.cpp index 9fb9a48..f4777b7 100644 --- a/Runtime/Scripting/Rendering/Rendering.bind.cpp +++ b/Runtime/Scripting/Rendering/Rendering.bind.cpp @@ -28,7 +28,7 @@ static luaL_Reg funcs[] = { int luaopen_GameLab_Engine_Rendering(lua_State* L) { - log_info("Scripting", "luaopen_GameLab_Engine_Rendering()"); + log_info_tag("Scripting", "luaopen_GameLab_Engine_Rendering()"); LUA_BIND_STATE(L); diff --git a/Runtime/Scripting/Resource/Resource.bind.cpp b/Runtime/Scripting/Resource/Resource.bind.cpp index 379d88d..a09460e 100644 --- a/Runtime/Scripting/Resource/Resource.bind.cpp +++ b/Runtime/Scripting/Resource/Resource.bind.cpp @@ -47,7 +47,7 @@ static luaL_Reg funcs[] = { int luaopen_GameLab_Engine_Resource(lua_State* L) { - log_info("Scripting", "luaopen_GameLab_Engine_Resource()"); + log_info_tag("Scripting", "luaopen_GameLab_Engine_Resource()"); LUA_BIND_STATE(L); |