Add option to use server timestamp from the message instead of the local clock time for logging. (#6346)
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
- Minor: Add a setting to change the emote and badge thumbnail size. (#6126)
|
- Minor: Add a setting to change the emote and badge thumbnail size. (#6126)
|
||||||
- Minor: Add an import and export button to image uploader settings. (#6284)
|
- Minor: Add an import and export button to image uploader settings. (#6284)
|
||||||
- Minor: Add a setting under Moderation -> Logs to customize the timestamp used for chat logs. (#6338)
|
- Minor: Add a setting under Moderation -> Logs to customize the timestamp used for chat logs. (#6338)
|
||||||
|
- Minor: Add a setting under Moderation -> Logs to use server timestamp from the message instead of the local clock time for logging. (#6346)
|
||||||
- Bugfix: Commands are no longer tab-completable in the middle of messages. (#6273)
|
- Bugfix: Commands are no longer tab-completable in the middle of messages. (#6273)
|
||||||
- Bugfix: Automatic streamer mode detection now works from Flatpak. (#6250)
|
- Bugfix: Automatic streamer mode detection now works from Flatpak. (#6250)
|
||||||
- Bugfix: Don't create native messaging manifest file if browser directory doesn't exist. (#6116)
|
- Bugfix: Don't create native messaging manifest file if browser directory doesn't exist. (#6116)
|
||||||
|
|||||||
@@ -571,6 +571,10 @@ public:
|
|||||||
"/logging/logTimestampFormat",
|
"/logging/logTimestampFormat",
|
||||||
"hh:mm:ss",
|
"hh:mm:ss",
|
||||||
};
|
};
|
||||||
|
BoolSetting tryUseTwitchTimestamps = {
|
||||||
|
"/logging/tryUseTwitchTimestamps",
|
||||||
|
false,
|
||||||
|
};
|
||||||
QStringSetting logPath = {"/logging/path", ""};
|
QStringSetting logPath = {"/logging/path", ""};
|
||||||
|
|
||||||
QStringSetting pathHighlightSound = {"/highlighting/highlightSoundPath",
|
QStringSetting pathHighlightSound = {"/highlighting/highlightSoundPath",
|
||||||
|
|||||||
@@ -166,9 +166,18 @@ void LoggingChannel::openStreamLogFile(const QString &streamID)
|
|||||||
void LoggingChannel::addMessage(const MessagePtr &message,
|
void LoggingChannel::addMessage(const MessagePtr &message,
|
||||||
const QString &streamID)
|
const QString &streamID)
|
||||||
{
|
{
|
||||||
QDateTime now = QDateTime::currentDateTime();
|
QDateTime messageTimestamp;
|
||||||
|
if (getSettings()->tryUseTwitchTimestamps &&
|
||||||
|
!message->serverReceivedTime.isNull())
|
||||||
|
{
|
||||||
|
messageTimestamp = message->serverReceivedTime;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
messageTimestamp = QDateTime::currentDateTime();
|
||||||
|
}
|
||||||
|
|
||||||
QString messageDateString = generateDateString(now);
|
QString messageDateString = generateDateString(messageTimestamp);
|
||||||
if (messageDateString != this->dateString)
|
if (messageDateString != this->dateString)
|
||||||
{
|
{
|
||||||
this->dateString = messageDateString;
|
this->dateString = messageDateString;
|
||||||
@@ -186,7 +195,7 @@ void LoggingChannel::addMessage(const MessagePtr &message,
|
|||||||
if (logTimestampFormat != "Disable")
|
if (logTimestampFormat != "Disable")
|
||||||
{
|
{
|
||||||
str.append('[');
|
str.append('[');
|
||||||
str.append(now.toString(logTimestampFormat));
|
str.append(messageTimestamp.toString(logTimestampFormat));
|
||||||
str.append("] ");
|
str.append("] ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "util/PostToThread.hpp"
|
#include "util/PostToThread.hpp"
|
||||||
#include "widgets/helper/EditableModelView.hpp"
|
#include "widgets/helper/EditableModelView.hpp"
|
||||||
#include "widgets/helper/IconDelegate.hpp"
|
#include "widgets/helper/IconDelegate.hpp"
|
||||||
|
#include "widgets/settingspages/SettingWidget.hpp"
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
@@ -165,6 +166,18 @@ ModerationPage::ModerationPage()
|
|||||||
logTimestampFormat->setToolTip("a = am/pm, zzz = milliseconds");
|
logTimestampFormat->setToolTip("a = am/pm, zzz = milliseconds");
|
||||||
logsTimestampFormatLayout.append(logTimestampFormat);
|
logsTimestampFormatLayout.append(logTimestampFormat);
|
||||||
|
|
||||||
|
SettingWidget::checkbox("Use Twitch's timestamps",
|
||||||
|
getSettings()->tryUseTwitchTimestamps)
|
||||||
|
->setTooltip(
|
||||||
|
"Try to use Twitch's timestamp (the time when the message was "
|
||||||
|
"received by Twitch's chat server), rather than your "
|
||||||
|
"computer's local timestamp.\nNote that using this setting can "
|
||||||
|
"result in out-of-order timestamps in the log files, and that "
|
||||||
|
"if Twitch's timestamp was unavailable for a message, it will "
|
||||||
|
"fall back to your computer's local timestamp.")
|
||||||
|
->conditionallyEnabledBy(getSettings()->enableLogging)
|
||||||
|
->addToLayout(logs->layout());
|
||||||
|
|
||||||
QCheckBox *onlyLogListedChannels =
|
QCheckBox *onlyLogListedChannels =
|
||||||
this->createCheckBox("Only log channels listed below",
|
this->createCheckBox("Only log channels listed below",
|
||||||
getSettings()->onlyLogListedChannels);
|
getSettings()->onlyLogListedChannels);
|
||||||
|
|||||||
@@ -590,6 +590,17 @@ void SettingWidget::addTo(GeneralPageView &view, QFormLayout *formLayout)
|
|||||||
formLayout->addRow(this->label, this->actionWidget);
|
formLayout->addRow(this->label, this->actionWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingWidget::addToLayout(QLayout *layout)
|
||||||
|
{
|
||||||
|
if (this->label == this->actionWidget)
|
||||||
|
{
|
||||||
|
layout->addWidget(this->actionWidget);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(false && "unimplemented");
|
||||||
|
}
|
||||||
|
|
||||||
void SettingWidget::registerWidget(GeneralPageView &view)
|
void SettingWidget::registerWidget(GeneralPageView &view)
|
||||||
{
|
{
|
||||||
if (this->label != nullptr)
|
if (this->label != nullptr)
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class QFormLayout;
|
class QFormLayout;
|
||||||
|
class QLayout;
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
@@ -121,6 +122,9 @@ public:
|
|||||||
void addTo(GeneralPageView &view);
|
void addTo(GeneralPageView &view);
|
||||||
void addTo(GeneralPageView &view, QFormLayout *formLayout);
|
void addTo(GeneralPageView &view, QFormLayout *formLayout);
|
||||||
|
|
||||||
|
/// For settings pages without a page view
|
||||||
|
void addToLayout(QLayout *layout);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Registers this widget & its optional label to the given page view
|
/// Registers this widget & its optional label to the given page view
|
||||||
void registerWidget(GeneralPageView &view);
|
void registerWidget(GeneralPageView &view);
|
||||||
|
|||||||
Reference in New Issue
Block a user