Added the functionality of having logs in custom folders as well as resetting the custom path to default.
This commit is contained in:
@@ -39,11 +39,26 @@ void LoggingManager::addMessage(const QString &channelName, messages::MessagePtr
|
||||
|
||||
QString LoggingManager::getDirectoryForChannel(const QString &channelName)
|
||||
{
|
||||
auto customPath = getApp()->settings->logPath;
|
||||
|
||||
if (channelName.startsWith("/whispers")) {
|
||||
if (customPath != "")
|
||||
return customPath + "/Whispers";
|
||||
return this->pathManager->whispersLogsFolderPath;
|
||||
} else if (channelName.startsWith("/mentions")) {
|
||||
if (customPath != "")
|
||||
return customPath + "/Mentions";
|
||||
return this->pathManager->mentionsLogsFolderPath;
|
||||
} else {
|
||||
if (customPath != "") {
|
||||
QString logPath(customPath + QDir::separator() + channelName);
|
||||
|
||||
if (!this->pathManager->createFolder(logPath)) {
|
||||
debug::Log("Error creating channel logs folder for channel {}", channelName);
|
||||
}
|
||||
|
||||
return logPath;
|
||||
}
|
||||
QString logPath(this->pathManager->channelsLogsFolderPath + QDir::separator() +
|
||||
channelName);
|
||||
|
||||
@@ -55,5 +70,12 @@ QString LoggingManager::getDirectoryForChannel(const QString &channelName)
|
||||
}
|
||||
}
|
||||
|
||||
void LoggingManager::refreshLoggingPath()
|
||||
{
|
||||
// if (app->settings->logPath == "") {
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
} // namespace singletons
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
|
||||
class PathManager;
|
||||
|
||||
class LoggingManager
|
||||
@@ -23,6 +22,8 @@ public:
|
||||
|
||||
void addMessage(const QString &channelName, messages::MessagePtr message);
|
||||
|
||||
void refreshLoggingPath();
|
||||
|
||||
private:
|
||||
std::map<QString, std::unique_ptr<LoggingChannel>> loggingChannels;
|
||||
QString getDirectoryForChannel(const QString &channelName);
|
||||
|
||||
@@ -101,6 +101,10 @@ public:
|
||||
/// Logging
|
||||
BoolSetting enableLogging = {"/logging/enabled", false};
|
||||
|
||||
BoolSetting customLogPath = {"/logging/customPath", false};
|
||||
|
||||
QStringSetting logPath = {"/logging/path", ""};
|
||||
|
||||
QStringSetting pathHighlightSound = {"/highlighting/highlightSoundPath",
|
||||
"qrc:/sounds/ping2.wav"};
|
||||
QStringSetting highlightUserBlacklist = {"/highlighting/blacklistedUsers", ""};
|
||||
|
||||
Reference in New Issue
Block a user