svn path=/trunk/mono/; revision=64203
[mono-project.git] / mono / utils / mono-logger.h
blob6cb56d27b91c5792548b672b4d20435a80091b34
1 #ifndef __MONO_LOGGER_H__
2 #define __MONO_LOGGER_H__
4 #include <glib.h>
6 G_BEGIN_DECLS
8 typedef enum {
9 MONO_TRACE_ASSEMBLY = (1<<0),
10 MONO_TRACE_TYPE = (1<<1),
11 MONO_TRACE_DLLIMPORT = (1<<2),
12 MONO_TRACE_GC = (1<<3),
13 MONO_TRACE_CONFIG = (1<<4),
14 MONO_TRACE_AOT = (1<<5),
15 MONO_TRACE_ALL = MONO_TRACE_ASSEMBLY |
16 MONO_TRACE_TYPE |
17 MONO_TRACE_DLLIMPORT |
18 MONO_TRACE_GC |
19 MONO_TRACE_CONFIG |
20 MONO_TRACE_AOT
21 } MonoTraceMask;
23 void
24 mono_trace_cleanup (void);
26 void
27 mono_trace (GLogLevelFlags level, MonoTraceMask mask, const char *format, ...);
29 void
30 mono_tracev (GLogLevelFlags level, MonoTraceMask mask, const char *format, va_list args);
32 void
33 mono_trace_set_level (GLogLevelFlags level);
35 void
36 mono_trace_set_level_string (const char *value);
38 void
39 mono_trace_set_mask (MonoTraceMask mask);
41 void
42 mono_trace_set_mask_string (char *value);
44 void
45 mono_trace_push (GLogLevelFlags level, MonoTraceMask mask);
47 void
48 mono_trace_pop (void);
50 gboolean
51 mono_trace_is_traced (GLogLevelFlags level, MonoTraceMask mask);
53 #ifdef G_HAVE_ISO_VARARGS
54 #define mono_trace_error(...) mono_trace(G_LOG_LEVEL_ERROR, \
55 __VA_ARGS__)
56 #define mono_trace_warning(...) mono_trace(G_LOG_LEVEL_WARNING, \
57 __VA_ARGS__)
58 #define mono_trace_message(...) mono_trace(G_LOG_LEVEL_MESSAGE, \
59 __VA_ARGS__)
60 #elif defined(G_HAVE_GNUC_VARARGS)
61 #define mono_trace_error(format...) mono_trace(G_LOG_LEVEL_ERROR, \
62 format)
63 #define mono_trace_warning(format...) mono_trace(G_LOG_LEVEL_WARNING, \
64 format)
65 #define mono_trace_message(format...) mono_trace(G_LOG_LEVEL_MESSAGE, \
66 format)
67 #else /* no varargs macros */
68 static void
69 mono_trace_error(MonoTraceMask mask, const char *format, ...)
71 va_list args;
72 va_start (args, format);
73 mono_tracev(G_LOG_LEVEL_ERROR, mask, format, args);
74 va_end (args);
77 static void
78 mono_trace_warning(MonoTraceMask mask, const char *format, ...)
80 va_list args;
81 va_start (args, format);
82 mono_tracev(G_LOG_LEVEL_WARNING, mask, format, args);
83 va_end (args);
86 static void
87 mono_trace_message(MonoTraceMask mask, const char *format, ...)
89 va_list args;
90 va_start (args, format);
91 mono_tracev(G_LOG_LEVEL_MESSAGE, mask, format, args);
92 va_end (args);
95 G_END_DECLS
97 #endif /* !__GNUC__ */
99 #endif /* __MONO_LOGGER_H__ */