mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05: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:
parent
c9f76eee75
commit
e4f34d9cd3
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user