diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | src/plugins/logger/logger.c | 46 |
2 files changed, 29 insertions, 20 deletions
@@ -1,7 +1,7 @@ WeeChat ChangeLog ================= Sébastien Helleu <flashcode@flashtux.org> -v0.3.3-dev, 2010-07-25 +v0.3.3-dev, 2010-07-28 Version 0.3.3 (under dev!) @@ -53,6 +53,7 @@ Version 0.3.3 (under dev!) (nick unavailable) * irc: set buffer local variable "away" when opening new channel (bug #29618) * fifo: fix bug with fifo pipe when setting fifo option to "on" +* logger: use tag "no_log" to prevent a line from being written in log file * xfer: fix bug with double quotes in DCC filenames (bug #30471) Version 0.3.2 (2010-04-18) diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c index 39a7e246b..ad1eaf13d 100644 --- a/src/plugins/logger/logger.c +++ b/src/plugins/logger/logger.c @@ -1125,6 +1125,11 @@ logger_line_log_level (int tags_count, const char **tags) for (i = 0; i < tags_count; i++) { + /* log disabled on line? return -1 */ + if (strcmp (tags[i], "no_log") == 0) + return -1; + + /* log level for line? return it */ if (strncmp (tags[i], "log", 3) == 0) { if (isdigit (tags[i][3])) @@ -1134,7 +1139,8 @@ logger_line_log_level (int tags_count, const char **tags) } } - return 9; + /* return default log level for line */ + return LOGGER_LEVEL_DEFAULT; } /* @@ -1158,27 +1164,29 @@ logger_print_cb (void *data, struct t_gui_buffer *buffer, time_t date, (void) highlight; line_log_level = logger_line_log_level (tags_count, tags); - - ptr_logger_buffer = logger_buffer_search_buffer (buffer); - if (ptr_logger_buffer - && ptr_logger_buffer->log_enabled - && (date > 0) - && (line_log_level <= ptr_logger_buffer->log_level)) + if (line_log_level >= 0) { - date_tmp = localtime (&date); - buf_time[0] = '\0'; - if (date_tmp) + ptr_logger_buffer = logger_buffer_search_buffer (buffer); + if (ptr_logger_buffer + && ptr_logger_buffer->log_enabled + && (date > 0) + && (line_log_level <= ptr_logger_buffer->log_level)) { - strftime (buf_time, sizeof (buf_time) - 1, - weechat_config_string (logger_config_file_time_format), - date_tmp); + date_tmp = localtime (&date); + buf_time[0] = '\0'; + if (date_tmp) + { + strftime (buf_time, sizeof (buf_time) - 1, + weechat_config_string (logger_config_file_time_format), + date_tmp); + } + + logger_write_line (ptr_logger_buffer, + "%s\t%s\t%s", + buf_time, + (prefix) ? prefix : "", + message); } - - logger_write_line (ptr_logger_buffer, - "%s\t%s\t%s", - buf_time, - (prefix) ? prefix : "", - message); } return WEECHAT_RC_OK; |