Changeset: 80181c379e1e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=80181c379e1e
Modified Files:
gdk/gdk_tracer.c
gdk/gdk_tracer.h
Branch: default
Log Message:
Reduce name space pollution.
diffs (148 lines):
diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -10,6 +10,28 @@
#include "gdk.h"
#include "gdk_tracer.h"
+// GDKtracer struct - Buffer and info
+#define BUFFER_SIZE 64000
+typedef struct GDKtracer {
+ int id;
+ char buffer[BUFFER_SIZE];
+ int allocated_size;
+} gdk_tracer;
+
+#define DEFAULT_ADAPTER BASIC
+#define DEFAULT_LOG_LEVEL M_ERROR
+#define DEFAULT_FLUSH_LEVEL M_INFO
+
+#define FILE_NAME "mdbtrace.log"
+
+#define OPENFILE_FAILED "Failed to open "FILE_NAME
+#define GDKTRACER_FAILED "Failed to write logs"
+
+#define AS_STR(x) #x
+#define STR(x) AS_STR(x)
+
+#define GENERATE_STRING(STRING) #STRING,
+
static gdk_tracer tracer = {.id = 0, .allocated_size = 0};
static gdk_tracer *active_tracer = &tracer;
@@ -25,6 +47,7 @@ static bool LOG_EXC_REP = false;
static LOG_LEVEL CUR_FLUSH_LEVEL = DEFAULT_FLUSH_LEVEL;
static bool GDK_TRACER_STOP = false;
+#define GENERATE_LOG_LEVEL(COMP) DEFAULT_LOG_LEVEL,
LOG_LEVEL LVL_PER_COMPONENT[] = {
FOREACH_COMP(GENERATE_LOG_LEVEL)
};
@@ -47,6 +70,31 @@ const char *LEVEL_STR[] = {
+/*
+ * GDKtracer Stream Macros
+ */
+// Exception
+#define GDK_TRACER_EXCEPTION(MSG, ...) \
+ mnstr_printf(GDKstdout, \
+ "%s " \
+ "%-"MXW"s " \
+ "%"MXW"s:%d " \
+ "%"MXW"s " \
+ "%-"MXW"s " \
+ "%-"MXW"s # "MSG, \
+ GDKtracer_get_timestamp("%Y-%m-%d %H:%M:%S", \
+ (char[20]){0}, 20), \
+ __FILE__, \
+ __func__, \
+ __LINE__, \
+ STR(M_CRITICAL), \
+ STR(GDK_TRACER), \
+ MT_thread_getname(), \
+ ## __VA_ARGS__);
+
+
+
+
// When BASIC adapter is active, all the log messages are getting printed to a
file.
// This function prepares a file in order to write the contents of the buffer
when necessary.
static gdk_return
diff --git a/gdk/gdk_tracer.h b/gdk/gdk_tracer.h
--- a/gdk/gdk_tracer.h
+++ b/gdk/gdk_tracer.h
@@ -35,27 +35,9 @@
#ifndef _GDK_TRACER_H_
#define _GDK_TRACER_H_
-#define INT_MAX_LEN ((__CHAR_BIT__ * sizeof(int) - 1) / 3 + 2)
-#define BUFFER_SIZE 64000
-
-#define DEFAULT_ADAPTER BASIC
-#define DEFAULT_LOG_LEVEL M_ERROR
-#define DEFAULT_FLUSH_LEVEL M_INFO
-
-#define FILE_NAME "mdbtrace.log"
-#define NAME_SEP '_'
-#define NULL_CHAR '\0'
#define MXW "20"
-#define OPENFILE_FAILED "Failed to open "FILE_NAME
-#define GDKTRACER_FAILED "Failed to write logs"
-
-#define AS_STR(x) #x
-#define STR(x) AS_STR(x)
-
#define GENERATE_ENUM(ENUM) ENUM,
-#define GENERATE_STRING(STRING) #STRING,
-#define GENERATE_LOG_LEVEL(COMP) DEFAULT_LOG_LEVEL,
// ADAPTERS
@@ -276,44 +258,6 @@ gdk_export LOG_LEVEL LVL_PER_COMPONENT[]
-// GDKtracer struct - Buffer and info
-typedef struct GDKtracer {
- int id;
- char buffer[BUFFER_SIZE];
- int allocated_size;
-} gdk_tracer;
-
-
-
-/*
- * GDKtracer Stream Macros
- */
-// Exception
-#define GDK_TRACER_EXCEPTION(MSG, ...) \
- mnstr_printf(GDKstdout, \
- "%s " \
- "%-"MXW"s " \
- "%"MXW"s:%d " \
- "%"MXW"s " \
- "%-"MXW"s " \
- "%-"MXW"s # "MSG, \
- GDKtracer_get_timestamp("%Y-%m-%d %H:%M:%S", \
- (char[20]){0}, 20), \
- __FILE__, \
- __func__, \
- __LINE__, \
- STR(M_CRITICAL), \
- STR(GDK_TRACER), \
- MT_thread_getname(), \
- ## __VA_ARGS__);
-
-
-#define GDK_TRACER_OSTREAM(MSG, ...) \
- mnstr_printf(GDKstdout, MSG, ## __VA_ARGS__)
-
-
-
-
/*
* GDKtracer API
* For the allowed log_levels, components and layers see the
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list