Last change
on this file since 714 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
|
Line | |
---|
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. |
---|
4 | |
---|
5 | #include "log.h" |
---|
6 | #include <common/nonstd_stdio.h> |
---|
7 | #include "stl-util.h" |
---|
8 | #include "Convert.h" |
---|
9 | |
---|
10 | const char* LOG_LEVEL[] = { "[DEBUG] ", "", "[WARN] ", "[ERROR] ", "[CRITICAL] " }; |
---|
11 | |
---|
12 | void logPrintf_va(const char *obj, const char *method, int level, const char *msgf, va_list va) |
---|
13 | { |
---|
14 | string buf = ssprintf_va(msgf, va); |
---|
15 | logMessage(obj, method, level, buf.c_str()); |
---|
16 | } |
---|
17 | |
---|
18 | void logPrintf(const char *obj, const char *method, int level, const char *msgf, ...) |
---|
19 | { |
---|
20 | va_list argptr; |
---|
21 | va_start(argptr, msgf); |
---|
22 | logPrintf_va(obj, method, level, msgf, argptr); |
---|
23 | va_end(argptr); |
---|
24 | } |
---|
25 | |
---|
26 | void log_printf(const char *msgf, ...) |
---|
27 | { |
---|
28 | va_list argptr; |
---|
29 | va_start(argptr, msgf); |
---|
30 | logPrintf_va("Message", "printf", LOG_INFO, msgf, argptr); |
---|
31 | va_end(argptr); |
---|
32 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.