summaryrefslogtreecommitdiff
path: root/source/utilities/Logger.cpp
diff options
context:
space:
mode:
authorViktor Mladenovski <viktor.mladenovski@stericsson.com>2011-05-20 14:10:59 +0200
committerViktor Mladenovski <viktor.mladenovski@stericsson.com>2011-05-20 14:10:59 +0200
commitf7e95217e936da34d7124aaced590692eb515923 (patch)
tree2d9ef4750a67d9d1dd3fe9180a4fef2929fad54b /source/utilities/Logger.cpp
Initial contribution of loader_communication
ST-Ericsson ID: 326913 ST-Ericsson FOSS-OUT ID: STETL-FOSS-OUT-10204 Change-Id: I171cfc2ee458a8a0a91a1916137d131f0f7ecee5
Diffstat (limited to 'source/utilities/Logger.cpp')
-rw-r--r--source/utilities/Logger.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/source/utilities/Logger.cpp b/source/utilities/Logger.cpp
new file mode 100644
index 0000000..d0370d6
--- /dev/null
+++ b/source/utilities/Logger.cpp
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (C) ST-Ericsson SA 2011
+ * License terms: 3-clause BSD license
+ ******************************************************************************/
+
+#include "Logger.h"
+using namespace std;
+
+#ifdef _WIN32
+#define flockfile _lock_file
+#define funlockfile _unlock_file
+#else
+#include <cstddef>
+#include "OS.h"
+#endif
+
+Logger::Logger(const void *communication): communication_(communication), messageCallback_(0)
+{
+}
+
+void Logger::log(const char *format, ...)
+{
+#ifdef _MESSAGES
+
+ if (0 != messageCallback_) {
+ CLockCS lock(criticalSection_);
+ va_list args;
+ char message[1024];
+ va_start(args, format);
+ vsprintf_s(message, format, args);
+ va_end(args);
+ messageCallback_(communication_, strlen(message), message);
+ }
+
+#endif
+}