aboutsummaryrefslogtreecommitdiffstats
path: root/plugin/icedteanp
diff options
context:
space:
mode:
authorJiri Vanek <[email protected]>2013-11-01 13:23:25 +0100
committerJiri Vanek <[email protected]>2013-11-01 13:23:25 +0100
commitf7d9707866ab118b6981207be54ab78c8b022fdc (patch)
treed4fedab3eeba02c2660cc4e4c0cadaee5696f5ba /plugin/icedteanp
parent113381d62d1eabb685f248573beff4195076740b (diff)
Synced headers between PLUGIN_DEBUG, PLUGIN_ERROR and javaside
* netx/net/sourceforge/jnlp/util/logging/OutputController.java: (getHeader) added thread id and name to log header. * plugin/icedteanp/IcedTeaPluginUtils.h: (PLUGIN_DEBUG) (PLUGIN_ERROR) headerrs generation code moved to macro (CREATE_HEADER0). Both headers now contains pthread_self and g_thread_self. Fixed indentation.
Diffstat (limited to 'plugin/icedteanp')
-rw-r--r--plugin/icedteanp/IcedTeaPluginUtils.h73
1 files changed, 38 insertions, 35 deletions
diff --git a/plugin/icedteanp/IcedTeaPluginUtils.h b/plugin/icedteanp/IcedTeaPluginUtils.h
index 7d2abdb..95aca25 100644
--- a/plugin/icedteanp/IcedTeaPluginUtils.h
+++ b/plugin/icedteanp/IcedTeaPluginUtils.h
@@ -78,43 +78,46 @@ exception statement from your version. */
} while (0)
-#define PLUGIN_DEBUG(...) \
- do \
- { \
- initialize_debug(); \
- if (plugin_debug) { \
- if (plugin_debug_to_streams) { \
- if (plugin_debug_headers) { \
- char s[1000]; \
- time_t t = time(NULL); \
- struct tm * p = localtime(&t); \
- strftime(s, 1000, "%a %b %d %H:%M:%S %Z %Y", p); \
- const char *userNameforDebug = (getenv("USERNAME") == NULL) ? "unknown user" : getenv("USERNAME"); \
- fprintf (stdout, "[%s][ITW-C-PLUGIN][MESSAGE_DEBUG][%s][%s:%d] ITNPP Thread# %ld: ", \
- userNameforDebug, s, __FILE__, __LINE__, pthread_self()); \
- } \
- fprintf (stdout, __VA_ARGS__); \
- } \
- } \
+//f is after expansion used as FILE*
+#define CREATE_HEADER(f) \
+ do \
+ { \
+ char s[200]; \
+ time_t t = time(NULL); \
+ struct tm p; \
+ localtime_r(&t, &p); \
+ strftime(s, 200, "%a %b %d %H:%M:%S %Z %Y", &p); \
+ const char *userNameforDebug = (getenv("USERNAME") == NULL) ? "unknown user" : getenv("USERNAME"); \
+ fprintf (f, "[%s][ITW-C-PLUGIN][MESSAGE_DEBUG][%s][%s:%d] ITNPP Thread# %ld, gthread %p: ", \
+ userNameforDebug, s, __FILE__, __LINE__, pthread_self(), g_thread_self ()); \
} while (0)
+
+
+#define PLUGIN_DEBUG(...) \
+ do \
+ { \
+ initialize_debug(); \
+ if (plugin_debug) { \
+ if (plugin_debug_to_streams) { \
+ if (plugin_debug_headers) { \
+ CREATE_HEADER(stdout); \
+ } \
+ fprintf (stdout, __VA_ARGS__); \
+ } \
+ } \
+ } while (0)
+
-// Error reporting macro.
-#define PLUGIN_ERROR(...) \
- do \
- { \
- initialize_debug(); \
- if (plugin_debug_to_streams) { \
- if (plugin_debug_headers) { \
- char s[1000]; \
- time_t t = time(NULL); \
- struct tm * p = localtime(&t); \
- strftime(s, 1000, "%A, %B %d %Y", p); \
- const char *userNameforDebug = (getenv("USERNAME") == NULL) ? "unknown user" : getenv("USERNAME"); \
- fprintf (stderr, "[%s][ITW-C-PLUGIN][ERROR_ALL][%s][%s:%d] thread %p: ", \
- userNameforDebug, s, __FILE__, __LINE__, g_thread_self ()); \
- } \
- fprintf (stderr, __VA_ARGS__); \
- } \
+#define PLUGIN_ERROR(...) \
+ do \
+ { \
+ initialize_debug(); \
+ if (plugin_debug_to_streams) { \
+ if (plugin_debug_headers) { \
+ CREATE_HEADER(stderr); \
+ } \
+ fprintf (stderr, __VA_ARGS__); \
+ } \
} while (0)