diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-11-13 12:01:00 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-11-13 12:01:00 +0100 |
commit | ac66ce6a74d60483f261242127865ec93f48738f (patch) | |
tree | 02362bc85155c259a16f97e4ce2b7393c468a429 /src/plugins | |
parent | d1689d3dd1c8e774c2d5a2a79139eca23f9721cf (diff) | |
download | weechat-ac66ce6a74d60483f261242127865ec93f48738f.zip |
Add local buffer variable "no_log", to prevent a buffer from logging to disk via logger plugin
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/irc/irc-debug.c | 1 | ||||
-rw-r--r-- | src/plugins/logger/logger.c | 14 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/plugins/irc/irc-debug.c b/src/plugins/irc/irc-debug.c index 0031086bc..fc92ff0b1 100644 --- a/src/plugins/irc/irc-debug.c +++ b/src/plugins/irc/irc-debug.c @@ -79,6 +79,7 @@ irc_debug_printf (struct t_irc_server *server, int send, int modified, weechat_buffer_set (irc_debug_buffer, "short_name", IRC_DEBUG_BUFFER_NAME); weechat_buffer_set (irc_debug_buffer, "localvar_set_server", IRC_DEBUG_BUFFER_NAME); weechat_buffer_set (irc_debug_buffer, "localvar_set_channel", IRC_DEBUG_BUFFER_NAME); + weechat_buffer_set (irc_debug_buffer, "localvar_set_no_log", "1"); /* disabled all highlights on this debug buffer */ weechat_buffer_set (irc_debug_buffer, "highlight_words", "-"); diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c index 31e46b790..14236bbab 100644 --- a/src/plugins/logger/logger.c +++ b/src/plugins/logger/logger.c @@ -130,9 +130,14 @@ logger_build_option_name (struct t_gui_buffer *buffer) int logger_get_level_for_buffer (struct t_gui_buffer *buffer) { - char *name, *option_name, *ptr_end; + char *no_log, *name, *option_name, *ptr_end; struct t_config_option *ptr_option; + /* no log for buffer if local variable "no_log" is defined for buffer */ + no_log = weechat_buffer_get_string (buffer, "localvar_no_log"); + if (no_log && no_log[0]) + return 0; + name = logger_build_option_name (buffer); if (!name) return LOGGER_LEVEL_DEFAULT; @@ -352,6 +357,7 @@ logger_write_line (struct t_logger_buffer *logger_buffer, time_t seconds; struct tm *date_tmp; char buf_time[256]; + int log_level; if (!logger_buf_write) logger_buf_write = malloc (LOGGER_BUF_WRITE_SIZE); @@ -362,6 +368,12 @@ logger_write_line (struct t_logger_buffer *logger_buffer, if (!logger_buffer->log_file) { + log_level = logger_get_level_for_buffer (logger_buffer->buffer); + if (log_level == 0) + { + logger_buffer_free (logger_buffer); + return; + } if (!logger_create_directory ()) { weechat_printf (NULL, |