summaryrefslogtreecommitdiffstats
path: root/src/Bindings/ManualBindings.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-04-01 09:32:14 +0200
committermadmaxoft <github@xoft.cz>2014-04-01 09:32:14 +0200
commit7aa6a3b86663ef28295ffb914f66a8f0359a353f (patch)
tree13285d8d715722e89c5eb61b40b0550b82858c4b /src/Bindings/ManualBindings.cpp
parentAPIDump: Documented the cCompositeChat support in logging functions. (diff)
downloadcuberite-7aa6a3b86663ef28295ffb914f66a8f0359a353f.tar
cuberite-7aa6a3b86663ef28295ffb914f66a8f0359a353f.tar.gz
cuberite-7aa6a3b86663ef28295ffb914f66a8f0359a353f.tar.bz2
cuberite-7aa6a3b86663ef28295ffb914f66a8f0359a353f.tar.lz
cuberite-7aa6a3b86663ef28295ffb914f66a8f0359a353f.tar.xz
cuberite-7aa6a3b86663ef28295ffb914f66a8f0359a353f.tar.zst
cuberite-7aa6a3b86663ef28295ffb914f66a8f0359a353f.zip
Diffstat (limited to 'src/Bindings/ManualBindings.cpp')
-rw-r--r--src/Bindings/ManualBindings.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp
index 95cd5e904..9d1a367df 100644
--- a/src/Bindings/ManualBindings.cpp
+++ b/src/Bindings/ManualBindings.cpp
@@ -143,7 +143,16 @@ static AString GetLogMessage(lua_State * tolua_S)
static int tolua_LOG(lua_State * tolua_S)
{
- cMCLogger::GetInstance()->LogSimple(GetLogMessage(tolua_S).c_str(), 0);
+ // If the param is a cCompositeChat, read the log level from it:
+ cMCLogger::eLogLevel LogLevel = cMCLogger::llRegular;
+ tolua_Error err;
+ if (tolua_isusertype(tolua_S, 1, "cCompositeChat", false, &err))
+ {
+ LogLevel = cCompositeChat::MessageTypeToLogLevel(((cCompositeChat *)tolua_tousertype(tolua_S, 1, NULL))->GetMessageType());
+ }
+
+ // Log the message:
+ cMCLogger::GetInstance()->LogSimple(GetLogMessage(tolua_S).c_str(), LogLevel);
return 0;
}
@@ -153,7 +162,7 @@ static int tolua_LOG(lua_State * tolua_S)
static int tolua_LOGINFO(lua_State * tolua_S)
{
- cMCLogger::GetInstance()->LogSimple(GetLogMessage(tolua_S).c_str(), 1);
+ cMCLogger::GetInstance()->LogSimple(GetLogMessage(tolua_S).c_str(), cMCLogger::llInfo);
return 0;
}
@@ -163,7 +172,7 @@ static int tolua_LOGINFO(lua_State * tolua_S)
static int tolua_LOGWARN(lua_State * tolua_S)
{
- cMCLogger::GetInstance()->LogSimple(GetLogMessage(tolua_S).c_str(), 2);
+ cMCLogger::GetInstance()->LogSimple(GetLogMessage(tolua_S).c_str(), cMCLogger::llWarning);
return 0;
}
@@ -173,7 +182,7 @@ static int tolua_LOGWARN(lua_State * tolua_S)
static int tolua_LOGERROR(lua_State * tolua_S)
{
- cMCLogger::GetInstance()->LogSimple(GetLogMessage(tolua_S).c_str(), 3);
+ cMCLogger::GetInstance()->LogSimple(GetLogMessage(tolua_S).c_str(), cMCLogger::llError);
return 0;
}