1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2012 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 "claws-features.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_FORMAT "[%Y-%m-%d %H:%M:%S] "
33 #define LOG_TIME_LEN 22
34 
35 typedef enum
36 {
37 	LOG_PROTOCOL = 0,
38 	LOG_DEBUG_FILTERING,
39 	/* reserved */
40 	LOG_INSTANCE_MAX
41 } LogInstance;
42 
43 typedef enum
44 {
45 	LOG_NORMAL,
46 	LOG_MSG,
47 	LOG_WARN,
48 	LOG_ERROR,
49 	LOG_STATUS_OK,
50 	LOG_STATUS_NOK,
51 	LOG_STATUS_SKIP
52 } LogType;
53 
54 typedef struct _LogText LogText;
55 
56 struct _LogText
57 {
58 	LogInstance  instance;
59 	gchar		*text;
60 	LogType		 type;
61 };
62 
63 /* logging */
64 void set_log_file	(LogInstance instance, const gchar *filename);
65 void close_log_file	(LogInstance instance);
66 const char *get_log_hook(LogInstance instance);
67 void set_log_title(LogInstance instance, gchar *title);
68 gchar *get_log_title(LogInstance instance);
69 void set_log_prefs(LogInstance instance, int* logwin_width, int* logwin_height);
70 void get_log_prefs(LogInstance instance, int** logwin_width, int** logwin_height);
71 gboolean get_log_error_capability(LogInstance instance);
72 void log_print		(LogInstance instance, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
73 void log_message	(LogInstance instance, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
74 void log_warning	(LogInstance instance, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
75 void log_error		(LogInstance instance, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
76 void log_status_ok	(LogInstance instance, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
77 void log_status_nok	(LogInstance instance, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
78 void log_status_skip	(LogInstance instance, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
79 
80 #endif /* LOG_H */
81