From ec167ba35669434dc1aadebd4e03c44fc5b04133 Mon Sep 17 00:00:00 2001 From: "mykola.salomatin" Date: Tue, 20 Oct 2020 19:13:15 +0300 Subject: [MTX-3669] mPower Release 5.4: alertservice and libmts shall print log messages to stderr --- src/MTS_Logger.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') 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); -- cgit v1.2.3 From f5122928882ebfb0f68bd7b17bc4c6fe95a7bbb6 Mon Sep 17 00:00:00 2001 From: "mykola.salomatin" Date: Tue, 10 Nov 2020 12:59:25 +0200 Subject: [MTX-3669] mPower Release 5.4: alertservice and libmts shall print log messages to stderr --- src/MTS_Logger.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/MTS_Logger.cpp b/src/MTS_Logger.cpp index eb879e3..1be2a0f 100644 --- a/src/MTS_Logger.cpp +++ b/src/MTS_Logger.cpp @@ -172,6 +172,19 @@ void Logger::printMessage(const int32_t& level, const char* label, const char* f } break; + case Logger::PrintMode::STDERR_AND_SYSLOG: { + if (level <= Logger::PrintLevel::TRACE_LEVEL) { + va_list argptr2; + va_copy(argptr2, argptr); + vsyslog(syslogPrintLevelConversion(level), format, argptr2); + va_end(argptr2); + } + fprintf(stderr, "%s|%s|", MTS::Text::time(MTS::System::timeMicros()).c_str(), label); + vfprintf(stderr, format, argptr); + fprintf(stderr, "\n"); + } + break; + case Logger::PrintMode::NO_PRINTING: default: break; -- cgit v1.2.3