1
0
mirror of https://github.com/irssi/irssi.git synced 2024-07-21 03:14:16 -04:00

When logs are rotated, automatically create the new directory where to open

the log if it has changed.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1897 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-10-22 21:26:58 +00:00 committed by cras
parent c9f76eee75
commit e4f34d9cd3
3 changed files with 8 additions and 3 deletions

View File

@ -165,7 +165,7 @@ void log_stop_logging(LOG_REC *log)
static void log_rotate_check(LOG_REC *log)
{
char *new_fname;
char *new_fname, *dir;
g_return_if_fail(log != NULL);
@ -177,6 +177,11 @@ static void log_rotate_check(LOG_REC *log)
/* rotate log */
log_stop_logging(log);
signal_emit("log rotated", 1, log);
dir = g_dirname(new_fname);
mkpath(dir, LOG_DIR_CREATE_MODE);
g_free(dir);
log_start_logging(log);
}
g_free(new_fname);

View File

@ -1,6 +1,8 @@
#ifndef __LOG_H
#define __LOG_H
#define LOG_DIR_CREATE_MODE 0770
enum {
LOG_ITEM_TARGET, /* channel, query, .. */
LOG_ITEM_WINDOW_REFNUM

View File

@ -40,8 +40,6 @@
/* close autologs after 5 minutes of inactivity */
#define AUTOLOG_INACTIVITY_CLOSE (60*5)
#define LOG_DIR_CREATE_MODE 0770
static int autolog_level;
static int autoremove_tag;
static const char *autolog_path;