talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

log.h (2230B)


      1 /*
      2  * Claws Mail -- 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 #include <glib.h>
     24 
     25 #define LOG_APPEND_TEXT_HOOKLIST "log_append_text"
     26 #define DEBUG_FILTERING_APPEND_TEXT_HOOKLIST "debug_append_text"
     27 
     28 #define LOG_TIME_FORMAT "[%Y-%m-%d %H:%M:%S] "
     29 #define LOG_TIME_LEN 22
     30 
     31 typedef enum
     32 {
     33 	LOG_PROTOCOL = 0,
     34 	LOG_DEBUG_FILTERING,
     35 	/* reserved */
     36 	LOG_INSTANCE_MAX
     37 } LogInstance;
     38 
     39 typedef enum
     40 {
     41 	LOG_NORMAL,
     42 	LOG_MSG,
     43 	LOG_WARN,
     44 	LOG_ERROR,
     45 	LOG_STATUS_OK,
     46 	LOG_STATUS_NOK,
     47 	LOG_STATUS_SKIP
     48 } LogType;
     49 
     50 typedef struct _LogText LogText;
     51 
     52 struct _LogText
     53 {
     54 	LogInstance  instance;
     55 	gchar		*text;
     56 	LogType		 type;
     57 };
     58 
     59 /* logging */
     60 void set_log_file	(LogInstance instance, const gchar *filename);
     61 void close_log_file	(LogInstance instance);
     62 const char *get_log_hook(LogInstance instance);
     63 void set_log_title(LogInstance instance, gchar *title);
     64 gchar *get_log_title(LogInstance instance);
     65 void set_log_prefs(LogInstance instance, int* logwin_width, int* logwin_height);
     66 void get_log_prefs(LogInstance instance, int** logwin_width, int** logwin_height);
     67 gboolean get_log_error_capability(LogInstance instance);
     68 void log_print		(LogInstance instance, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
     69 void log_message	(LogInstance instance, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
     70 void log_warning	(LogInstance instance, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
     71 void log_error		(LogInstance instance, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
     72 
     73 #endif /* LOG_H */