mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
fix logger crash (#136)
make logger don't crash when long messages put to logger. Currently longest message is 1024 chars. Longer messages are truncated
This commit is contained in:
parent
fff42f370c
commit
a930d4e403
@ -122,11 +122,11 @@ void Logger::Message(LogLevel level, const char* sourceFile, const char* func, u
|
|||||||
|| (GLOBAL_MIN_LOG_LEVEL > Logger::UNSET && level < GLOBAL_MIN_LOG_LEVEL) ) // global level set, use global level
|
|| (GLOBAL_MIN_LOG_LEVEL > Logger::UNSET && level < GLOBAL_MIN_LOG_LEVEL) ) // global level set, use global level
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const size_t max_msg_length = 1024;
|
||||||
char msg[512];
|
char msg[max_msg_length];
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start (args, fmt);
|
va_start (args, fmt);
|
||||||
vsprintf (msg,fmt, args);
|
vsnprintf (msg, max_msg_length, fmt, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
std::string location;
|
std::string location;
|
||||||
|
Loading…
Reference in New Issue
Block a user