mirror of
https://github.com/godotengine/godot.git
synced 2024-12-05 02:25:47 +00:00
Merge pull request #11853 from endragor/long-string-logging
Fix logging of long strings via RotatedFileLogger
This commit is contained in:
commit
fd1d886cf8
@ -177,11 +177,14 @@ void RotatedFileLogger::logv(const char *p_format, va_list p_list, bool p_err) {
|
||||
const int static_buf_size = 512;
|
||||
char static_buf[static_buf_size];
|
||||
char *buf = static_buf;
|
||||
va_list list_copy;
|
||||
va_copy(list_copy, p_list);
|
||||
int len = vsnprintf(buf, static_buf_size, p_format, p_list);
|
||||
if (len >= static_buf_size) {
|
||||
buf = (char *)Memory::alloc_static(len + 1);
|
||||
vsnprintf(buf, len + 1, p_format, p_list);
|
||||
vsnprintf(buf, len + 1, p_format, list_copy);
|
||||
}
|
||||
va_end(list_copy);
|
||||
file->store_buffer((uint8_t *)buf, len);
|
||||
if (len >= static_buf_size) {
|
||||
Memory::free_static(buf);
|
||||
|
Loading…
Reference in New Issue
Block a user