diff options
author | mykola.salomatin <mykola.salomatin@globallogic.com> | 2020-10-20 19:13:15 +0300 |
---|---|---|
committer | mykola.salomatin <mykola.salomatin@globallogic.com> | 2020-10-20 19:13:15 +0300 |
commit | ec167ba35669434dc1aadebd4e03c44fc5b04133 (patch) | |
tree | 319a6f68d17fd104528f53b2828c019adfb401ea | |
parent | cbbfbb27fd2b4e7d53f614f626090e88000453de (diff) | |
download | libmts-ec167ba35669434dc1aadebd4e03c44fc5b04133.tar.gz libmts-ec167ba35669434dc1aadebd4e03c44fc5b04133.tar.bz2 libmts-ec167ba35669434dc1aadebd4e03c44fc5b04133.zip |
[MTX-3669] mPower Release 5.4: alertservice and libmts shall print log messages to stderr
-rw-r--r-- | include/mts/MTS_Logger.h | 3 | ||||
-rw-r--r-- | src/MTS_Logger.cpp | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/include/mts/MTS_Logger.h b/include/mts/MTS_Logger.h index a1e88a2..b0beda9 100644 --- a/include/mts/MTS_Logger.h +++ b/include/mts/MTS_Logger.h @@ -116,7 +116,8 @@ namespace MTS { FILE_ONLY, SYSLOG_ONLY, STDOUT_AND_FILE, - STDOUT_AND_SYSLOG + STDOUT_AND_SYSLOG, + STDERR_ONLY }; static int getPrintLevel(); diff --git a/src/MTS_Logger.cpp b/src/MTS_Logger.cpp index 93775fe..eb879e3 100644 --- a/src/MTS_Logger.cpp +++ b/src/MTS_Logger.cpp @@ -124,6 +124,12 @@ void Logger::printMessage(const int32_t& level, const char* label, const char* f ::printf("\n"); break; + case Logger::PrintMode::STDERR_ONLY: + fprintf(stderr, "%s|%s|", MTS::Text::time(MTS::System::timeMicros()).c_str(), label); + vfprintf(stderr, format, argptr); + fprintf(stderr, "\n"); + break; + case Logger::PrintMode::FILE_ONLY: fprintf(m_pFile, "%s|%s| ", MTS::Text::time(MTS::System::timeMicros()).c_str(), label); vfprintf(m_pFile, format, argptr); |