diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2005-11-04 13:11:39 +0000 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2005-11-04 13:11:39 +0000 |
commit | dd3977367fa50d5f0d4fdb86534bb70415eeaa65 (patch) | |
tree | 988e6d41007b33fe872fa7d50fe1073fba9f50e5 /src/common | |
parent | 8a9e8ecc885fe254234a42b692f8c2e20d5c24a5 (diff) | |
download | weechat-dd3977367fa50d5f0d4fdb86534bb70415eeaa65.zip |
Fixed log problem with new color display system (now color codes are removed in
log file)
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/log.c | 33 | ||||
-rw-r--r-- | src/common/log.h | 2 |
2 files changed, 32 insertions, 3 deletions
diff --git a/src/common/log.c b/src/common/log.c index 1c18553ec..d6745171e 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -59,16 +59,45 @@ log_write_date (t_gui_buffer *buffer) } /* + * log_write_line: writes a line to log file + */ + +void +log_write_line (t_gui_buffer *buffer, char *message) +{ + char *msg_no_color; + + if (buffer->log_file) + { + wee_log_printf ("avant write line: %s\n", message); + msg_no_color = (char *)gui_color_decode ((unsigned char *)message, 0); + wee_log_printf ("apres decode: %s\n", msg_no_color); + log_write_date (buffer); + fprintf (buffer->log_file, "%s\n", + (msg_no_color) ? msg_no_color : message); + fflush (buffer->log_file); + if (msg_no_color) + free (msg_no_color); + } +} + +/* * log_write: writes a message to log file */ void log_write (t_gui_buffer *buffer, char *message) { + char *msg_no_color; + if (buffer->log_file) - { - fprintf (buffer->log_file, "%s", message); + { + msg_no_color = (char *)gui_color_decode ((unsigned char *)message, 0); + fprintf (buffer->log_file, "%s", + (msg_no_color) ? msg_no_color : message); fflush (buffer->log_file); + if (msg_no_color) + free (msg_no_color); } } diff --git a/src/common/log.h b/src/common/log.h index 7119d50af..8ac650d10 100644 --- a/src/common/log.h +++ b/src/common/log.h @@ -25,8 +25,8 @@ #include "../gui/gui.h" extern void log_write_date (t_gui_buffer *); +extern void log_write_line (t_gui_buffer *, char *); extern void log_write (t_gui_buffer *, char *); -extern void log_write_line (t_gui_buffer *, t_gui_line *); extern void log_start (t_gui_buffer *); extern void log_end (t_gui_buffer *); |