summaryrefslogtreecommitdiff
path: root/common/trace
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2010-04-09 11:30:09 -0400
committerStephen Gallagher <sgallagh@redhat.com>2010-04-14 12:15:54 -0400
commit18f93c1437931b4c04a4f64756ca6adfa333fb02 (patch)
tree4120f5c36c51eb1a905732320f3175e925551390 /common/trace
parentbf7247298136660f512bd1a96f68be1487f425b6 (diff)
downloadsssd-18f93c1437931b4c04a4f64756ca6adfa333fb02.tar.gz
sssd-18f93c1437931b4c04a4f64756ca6adfa333fb02.tar.bz2
sssd-18f93c1437931b4c04a4f64756ca6adfa333fb02.zip
Add ability to trace 64bit numbers
[TRACE] Adding macros for signed numbers
Diffstat (limited to 'common/trace')
-rw-r--r--common/trace/trace.h58
1 files changed, 56 insertions, 2 deletions
diff --git a/common/trace/trace.h b/common/trace/trace.h
index c7e375b7..04aa5c8b 100644
--- a/common/trace/trace.h
+++ b/common/trace/trace.h
@@ -52,7 +52,7 @@ extern unsigned trace_level;
} \
} while(0)
-/* Tracing numbers */
+/* Tracing unsigned numbers */
#define TRACE_NUMBER(level, msg, num) \
do { \
if (level & trace_level) { \
@@ -64,6 +64,42 @@ extern unsigned trace_level;
} \
} while(0)
+/* Tracing signed numbers */
+#define TRACE_SNUMBER(level, msg, num) \
+ do { \
+ if (level & trace_level) { \
+ printf("[DEBUG] %40s (%4d) %s%s %ld\n", \
+ __FILE__, __LINE__, \
+ (level == TRACE_ERROR) ? "ERROR-> " : "", \
+ (msg != NULL) ? msg : "MISSING MESSAGE", \
+ (long int)(num)); \
+ } \
+ } while(0)
+
+/* Tracing long numbers */
+#define TRACE_LNUMBER(level, msg, num) \
+ do { \
+ if (level & trace_level) { \
+ printf("[DEBUG] %40s (%4d) %s%s %llu\n", \
+ __FILE__, __LINE__, \
+ (level == TRACE_ERROR) ? "ERROR-> " : "", \
+ (msg != NULL) ? msg : "MISSING MESSAGE", \
+ (unsigned long long int)(num)); \
+ } \
+ } while(0)
+
+/* Tracing signed long numbers */
+#define TRACE_SLNUMBER(level, msg, num) \
+ do { \
+ if (level & trace_level) { \
+ printf("[DEBUG] %40s (%4d) %s%s %lld\n", \
+ __FILE__, __LINE__, \
+ (level == TRACE_ERROR) ? "ERROR-> " : "", \
+ (msg != NULL) ? msg : "MISSING MESSAGE", \
+ (long long int)(num)); \
+ } \
+ } while(0)
+
/* Tracing doubles */
#define TRACE_DOUBLE(level, msg, num) \
do { \
@@ -83,6 +119,9 @@ extern unsigned trace_level;
/* Noop in case the tracing is disabled */
#define TRACE_STRING(level, msg, str)
#define TRACE_NUMBER(level, msg, num)
+#define TRACE_SNUMBER(level, msg, num)
+#define TRACE_LNUMBER(level, msg, num)
+#define TRACE_SLNUMBER(level, msg, num)
#define TRACE_DOUBLE(level, msg, num)
#endif /* HAVE_TRACE */
@@ -92,11 +131,26 @@ extern unsigned trace_level;
#define TRACE_ERROR_STRING(msg, str) TRACE_STRING(TRACE_ERROR, msg, str)
#define TRACE_INFO_STRING(msg, str) TRACE_STRING(TRACE_INFO, msg, str)
-/* Convenience wrappers for numbers */
+/* Convenience wrappers for unsigned numbers */
#define TRACE_FLOW_NUMBER(msg, num) TRACE_NUMBER(TRACE_FLOW, msg, num)
#define TRACE_ERROR_NUMBER(msg, num) TRACE_NUMBER(TRACE_ERROR, msg, num)
#define TRACE_INFO_NUMBER(msg, num) TRACE_NUMBER(TRACE_INFO, msg, num)
+/* Convenience wrappers for signed numbers */
+#define TRACE_FLOW_SNUMBER(msg, num) TRACE_SNUMBER(TRACE_FLOW, msg, num)
+#define TRACE_ERROR_SNUMBER(msg, num) TRACE_SNUMBER(TRACE_ERROR, msg, num)
+#define TRACE_INFO_SNUMBER(msg, num) TRACE_SNUMBER(TRACE_INFO, msg, num)
+
+/* Convenience wrappers for 64-bit long unsigned numbers */
+#define TRACE_FLOW_LNUMBER(msg, num) TRACE_LNUMBER(TRACE_FLOW, msg, num)
+#define TRACE_ERROR_LNUMBER(msg, num) TRACE_LNUMBER(TRACE_ERROR, msg, num)
+#define TRACE_INFO_LNUMBER(msg, num) TRACE_LNUMBER(TRACE_INFO, msg, num)
+
+/* Convenience wrappers for 64-bit long signed numbers */
+#define TRACE_FLOW_SLNUMBER(msg, num) TRACE_SLNUMBER(TRACE_FLOW, msg, num)
+#define TRACE_ERROR_SLNUMBER(msg, num) TRACE_SLNUMBER(TRACE_ERROR, msg, num)
+#define TRACE_INFO_SLNUMBER(msg, num) TRACE_SLNUMBER(TRACE_INFO, msg, num)
+
/* Convenience wrappers for numbers */
#define TRACE_FLOW_DOUBLE(msg, num) TRACE_DOUBLE(TRACE_FLOW, msg, num)
#define TRACE_ERROR_DOUBLE(msg, num) TRACE_DOUBLE(TRACE_ERROR, msg, num)