feat: add setting to customize chat log timestamp (#6338)

This commit is contained in:
droidicus
2025-07-19 06:30:31 -04:00
committed by GitHub
parent 4944ce326f
commit f20945edc7
5 changed files with 28 additions and 5 deletions
+4 -1
View File
@@ -567,7 +567,10 @@ public:
"/logging/separatelyStoreStreamLogs",
false,
};
QStringSetting logTimestampFormat = {
"/logging/logTimestampFormat",
"hh:mm:ss",
};
QStringSetting logPath = {"/logging/path", ""};
QStringSetting pathHighlightSound = {"/highlighting/highlightSoundPath",
+7 -3
View File
@@ -182,9 +182,13 @@ void LoggingChannel::addMessage(const MessagePtr &message,
str.append("#" + message->channelName + " ");
}
str.append('[');
str.append(now.toString("HH:mm:ss"));
str.append("] ");
QString logTimestampFormat = getSettings()->logTimestampFormat;
if (logTimestampFormat != "Disable")
{
str.append('[');
str.append(now.toString(logTimestampFormat));
str.append("] ");
}
QString messageText;
if (message->loginName.isEmpty())
+1 -1
View File
@@ -521,7 +521,7 @@ void GeneralPage::initLayout(GeneralPageView &layout)
->addTo(layout);
layout.addDropdown<QString>(
"Timestamp format",
"Message timestamp format",
{"Disable", "h:mm", "hh:mm", "h:mm a", "hh:mm a", "h:mm:ss", "hh:mm:ss",
"h:mm:ss a", "hh:mm:ss a", "h:mm:ss.zzz", "h:mm:ss.zzz a",
"hh:mm:ss.zzz", "hh:mm:ss.zzz a"},
@@ -150,6 +150,21 @@ ModerationPage::ModerationPage()
}).result());
});
auto logsTimestampFormatLayout =
logs.emplace<QHBoxLayout>().withoutMargin();
auto logsTimestampFormatLabel =
logsTimestampFormatLayout.emplace<QLabel>();
logsTimestampFormatLabel->setText(
QString("Log file timestamp format: "));
QComboBox *logTimestampFormat = this->createComboBox(
{"Disable", "h:mm", "hh:mm", "h:mm a", "hh:mm a", "h:mm:ss",
"hh:mm:ss", "h:mm:ss a", "hh:mm:ss a", "h:mm:ss.zzz",
"h:mm:ss.zzz a", "hh:mm:ss.zzz", "hh:mm:ss.zzz a"},
getSettings()->logTimestampFormat);
logTimestampFormat->setToolTip("a = am/pm, zzz = milliseconds");
logsTimestampFormatLayout.append(logTimestampFormat);
QCheckBox *onlyLogListedChannels =
this->createCheckBox("Only log channels listed below",
getSettings()->onlyLogListedChannels);