aboutsummaryrefslogtreecommitdiff
path: root/tools/gator/daemon/Logging.h
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2013-10-15 10:29:57 +0800
committerAlex Shi <alex.shi@linaro.org>2013-10-15 10:29:57 +0800
commit93570f4be17a7a1d420b79e8a05fb5fe0b452297 (patch)
treed2877817c6ad79bdf2fd511f8b629b17714822ef /tools/gator/daemon/Logging.h
parent31d264741ef5baf75ec3d27c5b6e9bdda628748c (diff)
parent01239d6842a2e2653b7b42736cf2c10b69d0face (diff)
Merge remote-tracking branch 'arm-landing/lsk-3.10-gator' into linux-linaro-lsk-testlsk-13.10
Diffstat (limited to 'tools/gator/daemon/Logging.h')
-rw-r--r--tools/gator/daemon/Logging.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/tools/gator/daemon/Logging.h b/tools/gator/daemon/Logging.h
new file mode 100644
index 00000000000..8f960de27bf
--- /dev/null
+++ b/tools/gator/daemon/Logging.h
@@ -0,0 +1,47 @@
+/**
+ * Copyright (C) ARM Limited 2010-2013. 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.
+ */
+
+#ifndef __LOGGING_H__
+#define __LOGGING_H__
+
+#include <stdio.h>
+#include <string.h>
+#include <limits.h>
+#ifdef WIN32
+#include <windows.h>
+#else
+#include <pthread.h>
+#endif
+
+#define DRIVER_ERROR "\n Driver issue:\n >> gator.ko must be built against the current kernel version & configuration\n >> gator.ko should be co-located with gatord in the same directory\n >> OR insmod gator.ko prior to launching gatord"
+
+class Logging {
+public:
+ Logging(bool debug);
+ ~Logging();
+ void logError(const char* file, int line, const char* fmt, ...);
+ void logMessage(const char* fmt, ...);
+ char* getLastError() {return mErrBuf;}
+ char* getLastMessage() {return mLogBuf;}
+
+private:
+ char mErrBuf[4096]; // Arbitrarily large buffer to hold a string
+ char mLogBuf[4096]; // Arbitrarily large buffer to hold a string
+ bool mDebug;
+#ifdef WIN32
+ HANDLE mLoggingMutex;
+#else
+ pthread_mutex_t mLoggingMutex;
+#endif
+};
+
+extern Logging* logg;
+
+extern void handleException() __attribute__ ((noreturn));
+
+#endif //__LOGGING_H__