diff options
author | XTZGZoReX <none@none> | 2009-04-24 18:01:31 +0200 |
---|---|---|
committer | XTZGZoReX <none@none> | 2009-04-24 18:01:31 +0200 |
commit | c9c86b36df3ff7bb9b14a326f1156204a3fbdc95 (patch) | |
tree | 74077549608aab94d7271c212bacb3bb28f37f38 /src/shared/Log.cpp | |
parent | f235fb6694daf97251d152598189ff2f3c3e215e (diff) |
* Optimized Log::outDB by removing unneeded variadic argument parsing. Also use enum instead of explicit uint32.
--HG--
branch : trunk
Diffstat (limited to 'src/shared/Log.cpp')
-rw-r--r-- | src/shared/Log.cpp | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/shared/Log.cpp b/src/shared/Log.cpp index 152110012eb..f3fcae1faf7 100644 --- a/src/shared/Log.cpp +++ b/src/shared/Log.cpp @@ -344,28 +344,16 @@ std::string Log::GetTimestampStr() return std::string(buf); } -void Log::outDB( uint32 type, const char * str, ... ) +void Log::outDB( LogTypes type, const char * str ) { - if(type >= MAX_LOG_TYPES) - return; - - if(!str) + if(!str || std::string(str).empty() || type >= MAX_LOG_TYPES) return; std::string new_str(str); LoginDatabase.escape_string(new_str); - char nnew_str[MAX_QUERY_LEN]; - - va_list ap; - va_start(ap, str); - int res = vsnprintf(nnew_str, MAX_QUERY_LEN, new_str.c_str(), ap); - va_end(ap); - - if ( (res < 0) || (!nnew_str) || (std::string(nnew_str).empty()) ) - return; LoginDatabase.PExecute("INSERT INTO logs (time, realm, type, string) " - "VALUES ("I64FMTD", %u, %u, '%s');", uint64(time(0)), realm, type, nnew_str); + "VALUES ("I64FMTD", %u, %u, '%s');", uint64(time(0)), realm, (uint32)type, new_str.c_str()); } void Log::outString( const char * str, ... ) |