diff options
Diffstat (limited to 'source/utilities/Logger.cpp')
-rw-r--r-- | source/utilities/Logger.cpp | 36 |
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 +} |