summaryrefslogtreecommitdiff
path: root/drivers/gator/daemon/Logging.cpp
diff options
context:
space:
mode:
authorPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-24 17:15:43 +0200
committerPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-24 17:15:43 +0200
commited6e65a66f3bcf84dff4ff4e680096b7e40076d5 (patch)
treeef3c097361c500e1f6d44cad5f3872218eac8ab0 /drivers/gator/daemon/Logging.cpp
parent56fe6d63c36dc27747cd9b98c6ebd9cca0ab2899 (diff)
Revert "Merge remote-tracking branch 'armlt/previous-armlt-gator' into stable-linux-ux500-3.3"
This reverts commit a394b8c66756934bf0bc526da1b888e524313fb4, reversing changes made to a416f0c1e67d56752c38d8db621be99b3cf12bb8.
Diffstat (limited to 'drivers/gator/daemon/Logging.cpp')
-rw-r--r--drivers/gator/daemon/Logging.cpp79
1 files changed, 0 insertions, 79 deletions
diff --git a/drivers/gator/daemon/Logging.cpp b/drivers/gator/daemon/Logging.cpp
deleted file mode 100644
index 3e6f8a388a4..00000000000
--- a/drivers/gator/daemon/Logging.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * Copyright (C) ARM Limited 2010-2012. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include "OlyUtility.h"
-
-#ifdef WIN32
-#define MUTEX_INIT() mLoggingMutex = CreateMutex(NULL, false, NULL);
-#define MUTEX_LOCK() WaitForSingleObject(mLoggingMutex, 0xFFFFFFFF);
-#define MUTEX_UNLOCK() ReleaseMutex(mLoggingMutex);
-#define snprintf _snprintf
-#else
-#include <pthread.h>
-#define MUTEX_INIT() pthread_mutex_init(&mLoggingMutex, NULL)
-#define MUTEX_LOCK() pthread_mutex_lock(&mLoggingMutex)
-#define MUTEX_UNLOCK() pthread_mutex_unlock(&mLoggingMutex)
-#endif
-
-#include "Logging.h"
-
-// Global thread-safe logging
-Logging* logg = NULL;
-
-Logging::Logging(bool debug) {
- mDebug = debug;
- MUTEX_INIT();
-
- strcpy(mErrBuf, "Unknown Error");
- strcpy(mLogBuf, "Unknown Message");
-}
-
-Logging::~Logging() {
-}
-
-void Logging::logError(const char* file, int line, const char* fmt, ...) {
- va_list args;
-
- MUTEX_LOCK();
- if (mDebug) {
- snprintf(mErrBuf, sizeof(mErrBuf), "ERROR[%s:%d]: ", file, line);
- } else {
- mErrBuf[0] = 0;
- }
-
- va_start(args, fmt);
- vsnprintf(mErrBuf + strlen(mErrBuf), sizeof(mErrBuf) - 2 - strlen(mErrBuf), fmt, args); // subtract 2 for \n and \0
- va_end(args);
-
- if (strlen(mErrBuf) > 0) {
- strcat(mErrBuf, "\n");
- }
- MUTEX_UNLOCK();
-}
-
-void Logging::logMessage(const char* fmt, ...) {
- if (mDebug) {
- va_list args;
-
- MUTEX_LOCK();
- strcpy(mLogBuf, "INFO: ");
-
- va_start(args, fmt);
- vsnprintf(mLogBuf + strlen(mLogBuf), sizeof(mLogBuf) - 2 - strlen(mLogBuf), fmt, args); // subtract 2 for \n and \0
- va_end(args);
- strcat(mLogBuf, "\n");
-
- fprintf(stdout, "%s", mLogBuf);
- fflush(stdout);
- MUTEX_UNLOCK();
- }
-}