mirror of
https://github.com/irssi/irssi.git
synced 2026-08-10 12:23:37 +02:00
Some logging fixes. Flood checking had a memory leak. Query had a small
memory leak. Text buffer fixes. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@226 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
a0aa649368
commit
ae25925a1f
10 changed files with 129 additions and 89 deletions
|
|
@ -48,7 +48,7 @@ static void cmd_log_open(const char *data)
|
|||
char *params, *args, *targetarg, *rotatearg, *fname, *levels;
|
||||
char window[MAX_INT_STRLEN];
|
||||
LOG_REC *log;
|
||||
int opened, level, rotate;
|
||||
int level, rotate;
|
||||
|
||||
args = "targets rotate";
|
||||
params = cmd_get_params(data, 5 | PARAM_FLAG_MULTIARGS | PARAM_FLAG_GETREST,
|
||||
|
|
@ -73,12 +73,15 @@ static void cmd_log_open(const char *data)
|
|||
log = log_create_rec(fname, level, targetarg);
|
||||
if (log != NULL && log->handle == -1 && stristr(args, "-noopen") == NULL) {
|
||||
/* start logging */
|
||||
opened = log_start_logging(log);
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
|
||||
opened ? IRCTXT_LOG_OPENED :
|
||||
IRCTXT_LOG_CREATE_FAILED, fname);
|
||||
if (!opened) log_close(log);
|
||||
if (log_start_logging(log)) {
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
|
||||
IRCTXT_LOG_OPENED, fname);
|
||||
} else {
|
||||
log_close(log);
|
||||
log = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (log != NULL) {
|
||||
if (stristr(args, "-autoopen"))
|
||||
log->autoopen = TRUE;
|
||||
|
|
@ -366,6 +369,12 @@ static void sig_log_locked(LOG_REC *log)
|
|||
IRCTXT_LOG_LOCKED, log->fname);
|
||||
}
|
||||
|
||||
static void sig_log_create_failed(LOG_REC *log)
|
||||
{
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
|
||||
IRCTXT_LOG_CREATE_FAILED, log->fname, g_strerror(errno));
|
||||
}
|
||||
|
||||
static void read_settings(void)
|
||||
{
|
||||
int old_autolog = autolog_level;
|
||||
|
|
@ -401,6 +410,7 @@ void fe_log_init(void)
|
|||
signal_add("window item remove", (SIGNAL_FUNC) sig_window_item_remove);
|
||||
signal_add("window refnum changed", (SIGNAL_FUNC) sig_window_refnum_changed);
|
||||
signal_add("log locked", (SIGNAL_FUNC) sig_log_locked);
|
||||
signal_add("log create failed", (SIGNAL_FUNC) sig_log_create_failed);
|
||||
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
|
||||
}
|
||||
|
||||
|
|
@ -420,5 +430,6 @@ void fe_log_deinit(void)
|
|||
signal_remove("window item remove", (SIGNAL_FUNC) sig_window_item_remove);
|
||||
signal_remove("window refnum changed", (SIGNAL_FUNC) sig_window_refnum_changed);
|
||||
signal_remove("log locked", (SIGNAL_FUNC) sig_log_locked);
|
||||
signal_remove("log create failed", (SIGNAL_FUNC) sig_log_create_failed);
|
||||
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ FORMAT_REC fecommon_core_formats[] = {
|
|||
|
||||
{ "log_opened", "Log file %W$0%n opened", 1, { 0 } },
|
||||
{ "log_closed", "Log file %W$0%n closed", 1, { 0 } },
|
||||
{ "log_create_failed", "Couldn't create log file %W$0", 1, { 0 } },
|
||||
{ "log_create_failed", "Couldn't create log file %_$0%_: $1", 2, { 0, 0 } },
|
||||
{ "log_locked", "Log file %W$0%n is locked, probably by another running Irssi", 1, { 0 } },
|
||||
{ "log_not_open", "Log file %W$0%n not open", 1, { 0 } },
|
||||
{ "log_started", "Started logging to file %W$0", 1, { 0 } },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue