User-configurable log filename date formatting (When using "Append date to log filename")

The old defaults remain the same, so no worries for old users of this feature
Modify LogFileLocalChatDateFormat and LogFileIMsDateFormat in debug settings, use strftime's format specifiers.
The above mentioned settings are per account.

Inspired by irssi
This commit is contained in:
Inusaito Sayori
2013-08-15 23:25:00 -04:00
parent a5287ee975
commit 6910a2feca
2 changed files with 28 additions and 4 deletions

View File

@@ -47,14 +47,16 @@ std::string LLLogChat::makeLogFileName(std::string filename)
{
time_t now;
time(&now);
char dbuffer[20]; /* Flawfinder: ignore */
char dbuffer[100]; /* Flawfinder: ignore */
if (filename == "chat")
{
strftime(dbuffer, 20, "-%Y-%m-%d", localtime(&now));
static const LLCachedControl<std::string> local_chat_date_format(gSavedPerAccountSettings, "LogFileLocalChatDateFormat", "-%Y-%m-%d");
strftime(dbuffer, 100, local_chat_date_format().c_str(), localtime(&now));
}
else
{
strftime(dbuffer, 20, "-%Y-%m", localtime(&now));
static const LLCachedControl<std::string> ims_date_format(gSavedPerAccountSettings, "LogFileIMsDateFormat", "-%Y-%m");
strftime(dbuffer, 100, ims_date_format().c_str(), localtime(&now));
}
filename += dbuffer;
}