Jump to content

[patch][6539] Implement Two More Log Options For Script Library


Recommended Posts

Posted

Implement two more log options for script library: Consider it implementing the basic log options for ScriptLibrary

Revision: 6528+ (patch made for 6528)

Bug report: None

Who made it: NoFantasy

Info: especially the log option error_db_log will prove to become useful. SL already has the option to have database on it's own and in my opinion errors related to database should not just only display in console as they would be hard to find. It's expected SL will use proper prefix in errors and include data (such as table name, fields) to make the error clear.

Patch:

Index: src/shared/Log.cpp
===================================================================
--- src/shared/Log.cpp        (revision 6528)
+++ src/shared/Log.cpp        (working copy)
@@ -705,6 +705,20 @@
        MaNGOS::Singleton<Log>::Instance().outString(buf);
}

+void detail_log(const char * str, ...)
+{
+        if( !str )
+                return;
+
+        char buf[256];
+        va_list ap;
+        va_start(ap, str);
+        vsnprintf(buf,256, str, ap);
+        va_end(ap);
+
+        MaNGOS::Singleton<Log>::Instance().outDetail(buf);
+}
+
void debug_log(const char * str, ...)
{
        if( !str )
@@ -732,3 +746,17 @@

        MaNGOS::Singleton<Log>::Instance().outError(buf);
}
+
+void error_db_log(const char * str, ...)
+{
+        if( !str )
+                return;
+
+        char buf[256];
+        va_list ap;
+        va_start(ap, str);
+        vsnprintf(buf,256, str, ap);
+        va_end(ap);
+
+        MaNGOS::Singleton<Log>::Instance().outErrorDb(buf);
+}
Index: src/shared/Log.h
===================================================================
--- src/shared/Log.h        (revision 6528)
+++ src/shared/Log.h        (working copy)
@@ -147,6 +147,8 @@

// primary for script library
void MANGOS_DLL_SPEC outstring_log(const char * str, ...) ATTR_PRINTF(1,2);
+void MANGOS_DLL_SPEC detail_log(const char * str, ...) ATTR_PRINTF(1,2);
void MANGOS_DLL_SPEC debug_log(const char * str, ...) ATTR_PRINTF(1,2);
void MANGOS_DLL_SPEC error_log(const char * str, ...) ATTR_PRINTF(1,2);
+void MANGOS_DLL_SPEC error_db_log(const char * str, ...) ATTR_PRINTF(1,2);
#endif

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use