/LOG: Removed the -rotate option, it was pretty useless since adding

the % formats to file name already tells that the log should be
rotated.

Autologging supports log rotating now too, just add the wanted %
formats to /SET autolog_path


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@586 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-08-11 22:07:42 +00:00 committed by cras
commit ccf12d2bfc
4 changed files with 57 additions and 110 deletions

View file

@ -41,32 +41,25 @@ static int autolog_level;
static int autoremove_tag;
static const char *autolog_path;
/* SYNTAX: LOG OPEN [-noopen] [-autoopen] [-targets <targets>] [-window]
[-rotate hourly|daily|weekly|monthly] <fname> [<levels>] */
/* SYNTAX: LOG OPEN [-noopen] [-autoopen] [-targets <targets>]
[-window] <fname> [<levels>] */
static void cmd_log_open(const char *data)
{
GHashTable *optlist;
char *targetarg, *rotatearg, *fname, *levels;
char *targetarg, *fname, *levels;
void *free_arg;
char window[MAX_INT_STRLEN];
LOG_REC *log;
int level, rotate;
int level;
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTIONS | PARAM_FLAG_GETREST,
"log open", &optlist, &fname, &levels))
return;
targetarg = g_hash_table_lookup(optlist, "targets");
rotatearg = g_hash_table_lookup(optlist, "rotate");
if (*fname == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
rotate = LOG_ROTATE_NEVER;
if (rotatearg != NULL) {
rotate = log_str2rotate(rotatearg);
if (rotate < 0) rotate = LOG_ROTATE_NEVER;
}
level = level2bits(levels);
if (level == 0) level = MSGLEVEL_ALL;
@ -80,7 +73,6 @@ static void cmd_log_open(const char *data)
if (log != NULL) {
if (g_hash_table_lookup(optlist, "autoopen"))
log->autoopen = TRUE;
log->rotate = rotate;
log_update(log);
if (log->handle == -1 && g_hash_table_lookup(optlist, "noopen") == NULL) {
@ -153,7 +145,7 @@ static void cmd_log_stop(const char *data)
static void cmd_log_list(void)
{
GSList *tmp;
char *levelstr, *items, *rotate;
char *levelstr, *items;
int index;
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_LOG_LIST_HEADER);
@ -163,15 +155,11 @@ static void cmd_log_list(void)
levelstr = bits2level(rec->level);
items = rec->items == NULL ? NULL :
g_strjoinv(",", rec->items);
rotate = rec->rotate == 0 ? NULL :
g_strdup_printf(" -rotate %s", log_rotate2str(rec->rotate));
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_LOG_LIST,
index, rec->fname, items != NULL ? items : "",
levelstr, rotate != NULL ? rotate : "",
rec->autoopen ? " -autoopen" : "");
levelstr, rec->autoopen ? " -autoopen" : "");
g_free_not_null(rotate);
g_free_not_null(items);
g_free(levelstr);
}
@ -468,7 +456,7 @@ void fe_log_init(void)
signal_add("awaylog show", (SIGNAL_FUNC) sig_awaylog_show);
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
command_set_options("log open", "noopen autoopen -targets window -rotate");
command_set_options("log open", "noopen autoopen -targets window");
}
void fe_log_deinit(void)

View file

@ -80,7 +80,7 @@ FORMAT_REC fecommon_core_formats[] = {
{ "log_started", "Started logging to file %_$0", 1, { 0 } },
{ "log_stopped", "Stopped logging to file %_$0", 1, { 0 } },
{ "log_list_header", "Logs:", 0 },
{ "log_list", "$0 $1: $2 $3$4$5", 6, { 1, 0, 0, 0, 0, 0 } },
{ "log_list", "$0 $1: $2 $3$4", 5, { 1, 0, 0, 0, 0, 0 } },
{ "log_list_footer", "", 0 },
{ "windowlog_file", "Window LOGFILE set to $0", 1, { 0 } },
{ "windowlog_file_logging", "Can't change window's logfile while log is on", 0 },