mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-17 16:51:33 -04:00
Use printf_raw
This has the advantage of no memory allocation!
This commit is contained in:
parent
e96221ae13
commit
dcaabe0e1c
@ -114,8 +114,9 @@ void logging::log(log_level level, const std::string& s){
|
||||
void logging::logf(log_level level, const char* s, va_list va){
|
||||
thor_assert(!is_early(), "logf(level,string,...) is not valid in early mode");
|
||||
|
||||
auto formatted = vsprintf(s, va);
|
||||
log(level, formatted.c_str());
|
||||
char buffer[1024];
|
||||
vsprintf_raw(buffer, 1024, s, va);
|
||||
log(level, buffer);
|
||||
}
|
||||
|
||||
void logging::logf(log_level level, const char* s, ...){
|
||||
@ -123,8 +124,10 @@ void logging::logf(log_level level, const char* s, ...){
|
||||
|
||||
va_list va;
|
||||
va_start(va, s);
|
||||
auto formatted = vsprintf(s, va);
|
||||
va_end(va);
|
||||
|
||||
log(level, formatted.c_str());
|
||||
char buffer[1024];
|
||||
vsprintf_raw(buffer, 1024, s, va);
|
||||
log(level, buffer);
|
||||
|
||||
va_end(va);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user