diff options
-rw-r--r-- | src/command/cmd_defs.c | 2 | ||||
-rw-r--r-- | src/log.c | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c index 03e1d4be..e876b647 100644 --- a/src/command/cmd_defs.c +++ b/src/command/cmd_defs.c @@ -1857,7 +1857,7 @@ static struct cmd_t command_defs[] = { "Manage profanity log settings.") CMD_ARGS( { "where", "Show the current log file location." }, - { "rotate on|off", "Rotate log, default on." }, + { "rotate on|off", "Rotate log, default on. Does not take effect if you specified a filename yourself when starting Profanity." }, { "maxsize <bytes>", "With rotate enabled, specifies the max log size, defaults to 1048580 (1MB)." }, { "shared on|off", "Share logs between all instances, default: on. When off, the process id will be included in the log filename. Does not take effect if you specified a filename yourself when starting Profanity." }) CMD_NOEXAMPLES diff --git a/src/log.c b/src/log.c index 93488b28..10ca6389 100644 --- a/src/log.c +++ b/src/log.c @@ -56,6 +56,7 @@ static FILE* logp; static gchar* mainlogfile = NULL; +static gboolean user_provided_log = FALSE; static GTimeZone* tz; static GDateTime* dt; @@ -150,6 +151,11 @@ log_init(log_level_t filter, char* log_file) { level_filter = filter; tz = g_time_zone_new_local(); + + if (log_file) { + user_provided_log = TRUE; + } + gchar* lf = files_get_log_file(log_file); logp = fopen(lf, "a"); @@ -198,7 +204,7 @@ log_msg(log_level_t level, const char* const area, const char* const msg) fflush(logp); g_free(date_fmt); - if (prefs_get_boolean(PREF_LOG_ROTATE)) { + if (prefs_get_boolean(PREF_LOG_ROTATE) && !user_provided_log) { long result = ftell(logp); if (result != -1 && result >= prefs_get_max_log_size()) { _rotate_log_file(); |