summaryrefslogtreecommitdiff
path: root/tools/gator/daemon/Logging.h
diff options
context:
space:
mode:
authorJon Medhurst <tixy@linaro.org>2015-09-14 11:39:53 +0100
committerJon Medhurst <tixy@linaro.org>2015-09-14 11:39:53 +0100
commit4d35f06f9c3c0c807d3bc71141b116a2ae602343 (patch)
tree95764103e9331f243431709b907d7915ac069ffe /tools/gator/daemon/Logging.h
parent771c49e2ba7daa47aebb87184b5dc7bcdfb59a5a (diff)
parentf5bdd6b7426dfbab2003c0986545c8e34f5d9d63 (diff)
Merge branch 'lsk-3.18-armlt-gator' into integration-lsk-3.18-armlt-android
Conflicts: drivers/Makefile
Diffstat (limited to 'tools/gator/daemon/Logging.h')
-rw-r--r--tools/gator/daemon/Logging.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/tools/gator/daemon/Logging.h b/tools/gator/daemon/Logging.h
new file mode 100644
index 00000000000..a7b45239f5d
--- /dev/null
+++ b/tools/gator/daemon/Logging.h
@@ -0,0 +1,40 @@
+/**
+ * Copyright (C) ARM Limited 2010-2015. 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 <pthread.h>
+
+#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();
+#define logError(...) _logError(__func__, __FILE__, __LINE__, __VA_ARGS__)
+ __attribute__ ((format (printf, 5, 6)))
+ void _logError(const char *function, const char *file, int line, const char *fmt, ...);
+#define logMessage(...) _logMessage(__func__, __FILE__, __LINE__, __VA_ARGS__)
+ __attribute__ ((format (printf, 5, 6)))
+ void _logMessage(const char *function, const char *file, int line, 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;
+ pthread_mutex_t mLoggingMutex;
+};
+
+extern Logging *logg;
+
+extern void handleException() __attribute__ ((noreturn));
+
+#endif //__LOGGING_H__