galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
LuaLogging.cpp
Go to the documentation of this file.
1
7
8#include <sol/sol.hpp>
9
11
12namespace galaxy
13{
14 namespace lua
15 {
16 void log_wrapper(logging::LogLevel error_level, std::string_view message)
17 {
18 switch (error_level)
19 {
21 GALAXY_LOG(GALAXY_INFO, "{0}", message);
22 break;
23
25 GALAXY_LOG(GALAXY_DEBUG, "{0}", message);
26 break;
27
29 GALAXY_LOG(GALAXY_WARNING, "{0}", message);
30 break;
31
33 GALAXY_LOG(GALAXY_ERROR, "{0}", message);
34 break;
35
37 GALAXY_LOG(GALAXY_FATAL, "{0}", message);
38 break;
39 }
40 }
41
43 {
44 auto& lua = entt::locator<sol::state>::value();
45
46 // clang-format off
47 lua.new_enum<logging::LogLevel>("LogLevels",
48 {
54 });
55 // clang-format on
56
57 lua.set_function("galaxy_log", &log_wrapper);
58 }
59 } // namespace lua
60} // namespace galaxy
#define GALAXY_DEBUG
Definition Log.hpp:23
#define GALAXY_INFO
Log.hpp galaxy.
Definition Log.hpp:22
#define GALAXY_WARNING
Definition Log.hpp:24
#define GALAXY_LOG(level, msg,...)
Definition Log.hpp:29
#define GALAXY_FATAL
Definition Log.hpp:26
#define GALAXY_ERROR
Definition Log.hpp:25
LogLevel
Used to determine filtering and colouring of log messages.
Definition LogLevel.hpp:19
@ _DEBUG_
Debug Log Level.
@ _ERROR_
Error Log Level.
@ _FATAL_
Fatal Log Level.
@ _INFO_
Info Log Level.
@ _WARNING_
Warning Log Level.
void inject_logging()
Injects logging into Lua.
void log_wrapper(logging::LogLevel error_level, std::string_view message)
Timer.hpp galaxy.
Definition Async.hpp:17