aboutsummaryrefslogtreecommitdiff
path: root/daemon/Logging.h
diff options
context:
space:
mode:
Diffstat (limited to 'daemon/Logging.h')
-rw-r--r--daemon/Logging.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/daemon/Logging.h b/daemon/Logging.h
index 09e93ff..a7b4523 100644
--- a/daemon/Logging.h
+++ b/daemon/Logging.h
@@ -1,5 +1,5 @@
/**
- * Copyright (C) ARM Limited 2010-2014. All rights reserved.
+ * 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
@@ -17,10 +17,14 @@ 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;}
+#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
@@ -29,7 +33,7 @@ private:
pthread_mutex_t mLoggingMutex;
};
-extern Logging* logg;
+extern Logging *logg;
extern void handleException() __attribute__ ((noreturn));