1 #ifndef __MONO_LOGGER_INTERNAL_H__
2 #define __MONO_LOGGER_INTERNAL_H__
5 #include "mono-logger.h"
10 MONO_TRACE_ASSEMBLY = (1<<0),
11 MONO_TRACE_TYPE = (1<<1),
12 MONO_TRACE_DLLIMPORT = (1<<2),
13 MONO_TRACE_GC = (1<<3),
14 MONO_TRACE_CONFIG = (1<<4),
15 MONO_TRACE_AOT = (1<<5),
16 MONO_TRACE_SECURITY = (1<<6),
17 MONO_TRACE_THREADPOOL = (1<<7),
18 MONO_TRACE_IO_THREADPOOL = (1<<8),
19 MONO_TRACE_IO_LAYER = (1<<9),
20 MONO_TRACE_ALL = MONO_TRACE_ASSEMBLY |
22 MONO_TRACE_DLLIMPORT |
27 MONO_TRACE_THREADPOOL |
28 MONO_TRACE_IO_THREADPOOL |
32 extern GLogLevelFlags mono_internal_current_level;
33 extern MonoTraceMask mono_internal_current_mask;
36 mono_trace_init (void);
39 mono_trace_cleanup (void);
42 mono_tracev_inner (GLogLevelFlags level, MonoTraceMask mask, const char *format, va_list args);
45 mono_trace_set_level (GLogLevelFlags level);
48 mono_trace_set_mask (MonoTraceMask mask);
51 mono_trace_push (GLogLevelFlags level, MonoTraceMask mask);
54 mono_trace_pop (void);
57 mono_trace_is_traced (GLogLevelFlags level, MonoTraceMask mask);
59 G_GNUC_UNUSED static void
60 mono_tracev (GLogLevelFlags level, MonoTraceMask mask, const char *format, va_list args)
62 if(G_UNLIKELY (level <= mono_internal_current_level && mask & mono_internal_current_mask))
63 mono_tracev_inner (level, mask, format, args);
69 * @level: Verbose level of the specified message
70 * @mask: Type of the specified message
72 * Traces a new message, depending on the current logging level
75 G_GNUC_UNUSED static void
76 mono_trace (GLogLevelFlags level, MonoTraceMask mask, const char *format, ...)
78 if(G_UNLIKELY (level <= mono_internal_current_level && mask & mono_internal_current_mask)) {
80 va_start (args, format);
81 mono_tracev_inner (level, mask, format, args);
86 #ifdef G_HAVE_ISO_VARARGS
87 #define mono_trace_error(...) mono_trace(G_LOG_LEVEL_ERROR, \
89 #define mono_trace_warning(...) mono_trace(G_LOG_LEVEL_WARNING, \
91 #define mono_trace_message(...) mono_trace(G_LOG_LEVEL_MESSAGE, \
93 #elif defined(G_HAVE_GNUC_VARARGS)
94 #define mono_trace_error(format...) mono_trace(G_LOG_LEVEL_ERROR, \
96 #define mono_trace_warning(format...) mono_trace(G_LOG_LEVEL_WARNING, \
98 #define mono_trace_message(format...) mono_trace(G_LOG_LEVEL_MESSAGE, \
100 #else /* no varargs macros */
101 G_GNUC_UNUSED static void
102 mono_trace_error(MonoTraceMask mask, const char *format, ...)
105 va_start (args, format);
106 mono_tracev(G_LOG_LEVEL_ERROR, mask, format, args);
110 G_GNUC_UNUSED static void
111 mono_trace_warning(MonoTraceMask mask, const char *format, ...)
114 va_start (args, format);
115 mono_tracev(G_LOG_LEVEL_WARNING, mask, format, args);
119 G_GNUC_UNUSED static void
120 mono_trace_message(MonoTraceMask mask, const char *format, ...)
123 va_start (args, format);
124 mono_tracev(G_LOG_LEVEL_MESSAGE, mask, format, args);
128 #endif /* !__GNUC__ */
130 #if defined (PLATFORM_ANDROID) || (defined (TARGET_IOS) && defined (TARGET_IOS))
132 #define mono_gc_printf(gc_log_file, format, ...) g_log ("mono-gc", G_LOG_LEVEL_MESSAGE, format, ##__VA_ARGS__)
133 #define mono_runtime_printf(format, ...) g_log ("mono-rt", G_LOG_LEVEL_MESSAGE, format "\n", ##__VA_ARGS__)
134 #define mono_runtime_printf_err(format, ...) g_log ("mono-rt", G_LOG_LEVEL_CRITICAL, format "\n", ##__VA_ARGS__)
135 #define mono_runtime_stdout_fflush() do { } while (0)
139 #define mono_gc_printf(gc_log_file, format, ...) do { \
140 fprintf (gc_log_file, format, ##__VA_ARGS__); \
141 fflush (gc_log_file); \
144 #define mono_runtime_printf(format, ...) fprintf (stdout, format "\n", ##__VA_ARGS__)
145 #define mono_runtime_printf_err(format, ...) fprintf (stderr, format "\n", ##__VA_ARGS__)
146 #define mono_runtime_stdout_fflush() do { fflush (stdout); } while (0)
153 #endif /* __MONO_LOGGER_INTERNAL_H__ */