1 #ifndef LOG_H
2 #define LOG_H
3 
4 #define SEAFILE_DOMAIN g_quark_from_string("seafile")
5 
6 #ifndef seaf_warning
7 #define seaf_warning(fmt, ...) g_warning("%s(%d): " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
8 #endif
9 
10 #ifndef seaf_message
11 #define seaf_message(fmt, ...) g_message("%s(%d): " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
12 #endif
13 
14 
15 int seafile_log_init (const char *logfile, const char *ccnet_debug_level_str,
16                       const char *seafile_debug_level_str);
17 int seafile_log_reopen ();
18 
19 #ifndef WIN32
20 #ifdef SEAFILE_SERVER
21 void
22 set_syslog_config (GKeyFile *config);
23 #endif
24 #endif
25 
26 void
27 seafile_debug_set_flags_string (const gchar *flags_string);
28 
29 typedef enum
30 {
31     SEAFILE_DEBUG_TRANSFER = 1 << 1,
32     SEAFILE_DEBUG_SYNC = 1 << 2,
33     SEAFILE_DEBUG_WATCH = 1 << 3, /* wt-monitor */
34     SEAFILE_DEBUG_HTTP = 1 << 4,  /* http server */
35     SEAFILE_DEBUG_MERGE = 1 << 5,
36     SEAFILE_DEBUG_OTHER = 1 << 6,
37 } SeafileDebugFlags;
38 
39 void seafile_debug_impl (SeafileDebugFlags flag, const gchar *format, ...);
40 
41 #ifdef DEBUG_FLAG
42 
43 #undef seaf_debug
44 #define seaf_debug(fmt, ...)  \
45     seafile_debug_impl (DEBUG_FLAG, "%.10s(%d): " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
46 
47 #endif  /* DEBUG_FLAG */
48 
49 #endif
50