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_W32HANDLE = (1<<10),
21 MONO_TRACE_ALL = MONO_TRACE_ASSEMBLY |
23 MONO_TRACE_DLLIMPORT |
28 MONO_TRACE_THREADPOOL |
29 MONO_TRACE_IO_THREADPOOL |
34 extern GLogLevelFlags mono_internal_current_level;
35 extern MonoTraceMask mono_internal_current_mask;
38 mono_trace_init (void);
41 mono_trace_cleanup (void);
44 mono_tracev_inner (GLogLevelFlags level, MonoTraceMask mask, const char *format, va_list args);
47 mono_trace_set_level (GLogLevelFlags level);
50 mono_trace_set_mask (MonoTraceMask mask);
53 mono_trace_push (GLogLevelFlags level, MonoTraceMask mask);
56 mono_trace_pop (void);
59 mono_trace_is_traced (GLogLevelFlags level, MonoTraceMask mask);
61 G_GNUC_UNUSED static void
62 mono_tracev (GLogLevelFlags level, MonoTraceMask mask, const char *format, va_list args)
64 if(G_UNLIKELY (level <= mono_internal_current_level && mask & mono_internal_current_mask))
65 mono_tracev_inner (level, mask, format, args);
71 * @level: Verbose level of the specified message
72 * @mask: Type of the specified message
74 * Traces a new message, depending on the current logging level
77 G_GNUC_UNUSED static void
78 mono_trace (GLogLevelFlags level, MonoTraceMask mask, const char *format, ...)
80 if(G_UNLIKELY (level <= mono_internal_current_level && mask & mono_internal_current_mask)) {
82 va_start (args, format);
83 mono_tracev_inner (level, mask, format, args);
88 #ifdef G_HAVE_ISO_VARARGS
89 #define mono_trace_error(...) mono_trace(G_LOG_LEVEL_ERROR, \
91 #define mono_trace_warning(...) mono_trace(G_LOG_LEVEL_WARNING, \
93 #define mono_trace_message(...) mono_trace(G_LOG_LEVEL_MESSAGE, \
95 #elif defined(G_HAVE_GNUC_VARARGS)
96 #define mono_trace_error(format...) mono_trace(G_LOG_LEVEL_ERROR, \
98 #define mono_trace_warning(format...) mono_trace(G_LOG_LEVEL_WARNING, \
100 #define mono_trace_message(format...) mono_trace(G_LOG_LEVEL_MESSAGE, \
102 #else /* no varargs macros */
103 G_GNUC_UNUSED static void
104 mono_trace_error(MonoTraceMask mask, const char *format, ...)
107 va_start (args, format);
108 mono_tracev(G_LOG_LEVEL_ERROR, mask, format, args);
112 G_GNUC_UNUSED static void
113 mono_trace_warning(MonoTraceMask mask, const char *format, ...)
116 va_start (args, format);
117 mono_tracev(G_LOG_LEVEL_WARNING, mask, format, args);
121 G_GNUC_UNUSED static void
122 mono_trace_message(MonoTraceMask mask, const char *format, ...)
125 va_start (args, format);
126 mono_tracev(G_LOG_LEVEL_MESSAGE, mask, format, args);
130 #endif /* !__GNUC__ */
132 #if defined (PLATFORM_ANDROID) || (defined (TARGET_IOS) && defined (TARGET_IOS))
134 #define mono_gc_printf(gc_log_file, format, ...) g_log ("mono-gc", G_LOG_LEVEL_MESSAGE, format, ##__VA_ARGS__)
135 #define mono_runtime_printf(format, ...) g_log ("mono-rt", G_LOG_LEVEL_MESSAGE, format "\n", ##__VA_ARGS__)
136 #define mono_runtime_printf_err(format, ...) g_log ("mono-rt", G_LOG_LEVEL_CRITICAL, format "\n", ##__VA_ARGS__)
137 #define mono_runtime_stdout_fflush() do { } while (0)
141 #define mono_gc_printf(gc_log_file, format, ...) do { \
142 fprintf (gc_log_file, format, ##__VA_ARGS__); \
143 fflush (gc_log_file); \
146 #define mono_runtime_printf(format, ...) fprintf (stdout, format "\n", ##__VA_ARGS__)
147 #define mono_runtime_printf_err(format, ...) fprintf (stderr, format "\n", ##__VA_ARGS__)
148 #define mono_runtime_stdout_fflush() do { fflush (stdout); } while (0)
155 #endif /* __MONO_LOGGER_INTERNAL_H__ */