2009-01-09 [paul] 3.7.0cvs22
[claws.git] / src / common / log.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2009 Hiroyuki Yamamoto and the Claws Mail team
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  * 
18  */
19
20 #ifndef LOG_H
21 #define LOG_H
22
23 #ifdef HAVE_CONFIG_H
24 #  include "config.h"
25 #endif
26
27 #include <glib.h>
28
29 #define LOG_APPEND_TEXT_HOOKLIST "log_append_text"
30 #define DEBUG_FILTERING_APPEND_TEXT_HOOKLIST "debug_append_text"
31
32 #define LOG_TIME_LEN 11
33
34 typedef enum
35 {
36         LOG_PROTOCOL = 0,
37         LOG_DEBUG_FILTERING,
38         /* reserved */
39         LOG_INSTANCE_MAX
40 } LogInstance;
41
42 typedef enum
43 {
44         LOG_NORMAL,
45         LOG_MSG,
46         LOG_WARN,
47         LOG_ERROR,
48         LOG_STATUS_OK,
49         LOG_STATUS_NOK,
50         LOG_STATUS_SKIP
51 } LogType;
52
53 typedef struct _LogText LogText;
54
55 struct _LogText
56 {
57         LogInstance  instance;
58         gchar           *text;
59         LogType          type;  
60 };
61
62 /* logging */
63 void set_log_file       (LogInstance instance, const gchar *filename);
64 void close_log_file     (LogInstance instance);
65 const char *get_log_hook(LogInstance instance);
66 void set_log_title(LogInstance instance, gchar *title);
67 gchar *get_log_title(LogInstance instance);
68 void set_log_prefs(LogInstance instance, int* logwin_width, int* logwin_height);
69 void get_log_prefs(LogInstance instance, int** logwin_width, int** logwin_height);
70 void log_print          (LogInstance instance, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
71 void log_message        (LogInstance instance, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
72 void log_warning        (LogInstance instance, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
73 void log_error          (LogInstance instance, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
74 void log_status_ok      (LogInstance instance, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
75 void log_status_nok     (LogInstance instance, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
76 void log_status_skip    (LogInstance instance, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
77
78 #endif /* LOG_H */