File: logging.h

package info (click to toggle)
python-bibtex 1.2.4-1.1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 392 kB
  • ctags: 613
  • sloc: ansic: 2,834; yacc: 372; python: 247; lex: 175; makefile: 53
file content (68 lines) | stat: -rw-r--r-- 1,822 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef __logging_h__
#define __logging_h__

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
    
#define BIB_LEVEL_ERROR   (1 << (G_LOG_LEVEL_USER_SHIFT + 0))
#define BIB_LEVEL_WARNING (1 << (G_LOG_LEVEL_USER_SHIFT + 1))
#define BIB_LEVEL_MESSAGE (1 << (G_LOG_LEVEL_USER_SHIFT + 2))
    
#ifdef  __GNUC__
#define bibtex_error(format, args...)        g_log (G_LOG_DOMAIN, \
                                               BIB_LEVEL_ERROR, \
                                               format, ##args)
#define bibtex_message(format, args...)      g_log (G_LOG_DOMAIN, \
                                               BIB_LEVEL_MESSAGE, \
                                               format, ##args)
#define bibtex_warning(format, args...)      g_log (G_LOG_DOMAIN, \
                                               BIB_LEVEL_WARNING, \
                                               format, ##args)
#else   /* !__GNUC__ */

    static inline void
    bibtex_error (const gchar *format,
		  ...)
    {
	va_list args;
	va_start (args, format);
	g_logv (G_LOG_DOMAIN, BIB_LEVEL_ERROR, format, args);
	va_end (args);
    }

    static inline void
    bibtex_message (const gchar *format,
		    ...)
    {
	va_list args;
	va_start (args, format);
	g_logv (G_LOG_DOMAIN, BIB_LEVEL_MESSAGE, format, args);
	va_end (args);
    }

    static inline void
    bibtex_warning (const gchar *format,
		    ...)
    {
	va_list args;
	va_start (args, format);
	g_logv (G_LOG_DOMAIN, BIB_LEVEL_WARNING, format, args);
	va_end (args);
    }
#endif /* !GNUC */

    void bibtex_set_default_handler (void);
    
    void bibtex_message_handler (const gchar *log_domain,
				 GLogLevelFlags log_level,
				 const gchar *message,
				 gpointer user_data);


    
#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* logging.h */