summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeff Hatch <jhatch@multitech.com>2020-11-10 08:25:37 -0600
committerJeff Hatch <jhatch@multitech.com>2020-11-10 08:25:37 -0600
commit7ba216743f5a413ff3093cfe169718894836cb62 (patch)
treed0fc2765f53db02550a81cde3883a9160e937772 /src
parentcbbfbb27fd2b4e7d53f614f626090e88000453de (diff)
parentf5122928882ebfb0f68bd7b17bc4c6fe95a7bbb6 (diff)
downloadlibmts-7ba216743f5a413ff3093cfe169718894836cb62.tar.gz
libmts-7ba216743f5a413ff3093cfe169718894836cb62.tar.bz2
libmts-7ba216743f5a413ff3093cfe169718894836cb62.zip
Merge branch 'ms/MTX-3669_alertservice_shall_print_messages_to_stderr' into 'master' 0.8
[MTX-3669] mPower Release 5.4: alertservice and libmts shall print log messages to stderr See merge request !2
Diffstat (limited to 'src')
-rw-r--r--src/MTS_Logger.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/MTS_Logger.cpp b/src/MTS_Logger.cpp
index 93775fe..1be2a0f 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);
@@ -166,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;