Last change
on this file since 555 was
511,
checked in by Maciej Komosinski, 9 years ago
|
Improved handling of multiline messages by loggers
|
-
Property svn:eol-style set to
native
|
File size:
895 bytes
|
Rev | Line | |
---|
[286] | 1 | // This file is a part of Framsticks SDK. http://www.framsticks.com/ |
---|
| 2 | // Copyright (C) 1999-2015 Maciej Komosinski and Szymon Ulatowski. |
---|
| 3 | // See LICENSE.txt for details. |
---|
[122] | 4 | |
---|
[375] | 5 | #include "log.h" |
---|
[109] | 6 | #include <common/nonstd_stdio.h> |
---|
[180] | 7 | #include "stl-util.h" |
---|
[109] | 8 | #include "Convert.h" |
---|
| 9 | |
---|
[375] | 10 | const char* LOG_LEVEL[] = { "[DEBUG] ", "", "[WARN] ", "[ERROR] ", "[CRITICAL] " }; |
---|
[109] | 11 | |
---|
[375] | 12 | void logPrintf_va(const char *obj, const char *method, int level, const char *msgf, va_list va) |
---|
[109] | 13 | { |
---|
[375] | 14 | string buf = ssprintf_va(msgf, va); |
---|
| 15 | logMessage(obj, method, level, buf.c_str()); |
---|
[109] | 16 | } |
---|
| 17 | |
---|
[375] | 18 | void logPrintf(const char *obj, const char *method, int level, const char *msgf, ...) |
---|
[109] | 19 | { |
---|
| 20 | va_list argptr; |
---|
[375] | 21 | va_start(argptr, msgf); |
---|
| 22 | logPrintf_va(obj, method, level, msgf, argptr); |
---|
[109] | 23 | va_end(argptr); |
---|
| 24 | } |
---|
| 25 | |
---|
[375] | 26 | void log_printf(const char *msgf, ...) |
---|
[109] | 27 | { |
---|
| 28 | va_list argptr; |
---|
[375] | 29 | va_start(argptr, msgf); |
---|
| 30 | logPrintf_va("Message", "printf", LOG_INFO, msgf, argptr); |
---|
[109] | 31 | va_end(argptr); |
---|
| 32 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.