summaryrefslogtreecommitdiff
path: root/src/CommonAPI
diff options
context:
space:
mode:
Diffstat (limited to 'src/CommonAPI')
-rw-r--r--src/CommonAPI/Logger.cpp11
-rw-r--r--src/CommonAPI/Runtime.cpp19
2 files changed, 23 insertions, 7 deletions
diff --git a/src/CommonAPI/Logger.cpp b/src/CommonAPI/Logger.cpp
index 4514bd7..f7e2de3 100644
--- a/src/CommonAPI/Logger.cpp
+++ b/src/CommonAPI/Logger.cpp
@@ -39,6 +39,13 @@ Logger::Logger() {
#endif
}
+Logger::~Logger() {
+#ifdef USE_DLT
+ DLT_UNREGISTER_CONTEXT(dlt_);
+ DLT_UNREGISTER_APP();
+#endif
+}
+
void
Logger::init(bool _useConsole, const std::string &_fileName, bool _useDlt, const std::string &_level) {
#ifdef USE_CONSOLE
@@ -63,13 +70,13 @@ void
Logger::doLog(Level _level, const std::string &_message) {
#ifdef USE_CONSOLE
if (useConsole_) {
- std::lock_guard<std::mutex> consoleGuard(mutex_);
+ std::lock_guard<std::mutex> itsLock(mutex_);
std::cout << "[CAPI][" << levelAsString(_level) << "] " << _message << std::endl;
}
#endif
#ifdef USE_FILE
if (file_ && file_->is_open()) {
- std::lock_guard<std::mutex> consoleGuard(mutex_);
+ std::lock_guard<std::mutex> itsLock(mutex_);
(*(file_.get())) << "[CAPI][" << levelAsString(_level) << "] " << _message << std::endl;
}
#endif
diff --git a/src/CommonAPI/Runtime.cpp b/src/CommonAPI/Runtime.cpp
index 74c2c0f..9cd73eb 100644
--- a/src/CommonAPI/Runtime.cpp
+++ b/src/CommonAPI/Runtime.cpp
@@ -153,6 +153,11 @@ Runtime::readConfiguration() {
if (!reader.load(config))
return false;
+ std::string itsConsole("true");
+ std::string itsFile;
+ std::string itsDlt("false");
+ std::string itsLevel("info");
+
std::shared_ptr<IniFileReader::Section> section
= reader.getSection("logging");
if (section) {
@@ -160,13 +165,13 @@ Runtime::readConfiguration() {
std::string itsFile = section->getValue("file");
std::string itsDlt = section->getValue("dlt");
std::string itsLevel = section->getValue("level");
-
- Logger::init((itsConsole == "true"),
- itsFile,
- (itsDlt == "true"),
- itsLevel);
}
+ Logger::init((itsConsole == "true"),
+ itsFile,
+ (itsDlt == "true"),
+ itsLevel);
+
section = reader.getSection("default");
if (section) {
std::string binding = section->getValue("binding");
@@ -298,7 +303,11 @@ Runtime::getLibrary(
// name.
library = getProperty("LibraryBase");
if (library != "") {
+#ifdef WIN32
+ library = library + "-" + defaultBinding_;
+#else
library = "lib" + library + "-" + defaultBinding_;
+#endif
} else {
library = "lib" + _domain + "__" + _interface + "__" + _instance;
std::replace(library.begin(), library.end(), '.', '_');