refactor: CoreProcess use FileTail::setWatchedFile if the file to tail changes
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Deskflow -- mouse and keyboard sharing utility
|
||||
* SPDX-FileCopyrightText: (C) 2025 Chris Rizzitello <sithlord48@gmail.com>
|
||||
* SPDX-FileCopyrightText: (C) 2025 - 2026 Chris Rizzitello <sithlord48@gmail.com>
|
||||
* SPDX-FileCopyrightText: (C) 2024 - 2025 Symless Ltd.
|
||||
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
||||
*/
|
||||
@ -135,13 +135,15 @@ void CoreProcess::daemonIpcClientConnected()
|
||||
applyLogLevel();
|
||||
|
||||
const auto logPath = requestDaemonLogPath();
|
||||
if (!logPath.isEmpty()) {
|
||||
if (m_daemonFileTail != nullptr) {
|
||||
disconnect(m_daemonFileTail, &FileTail::newLine, this, &CoreProcess::handleLogLines);
|
||||
m_daemonFileTail->deleteLater();
|
||||
}
|
||||
if (logPath.isEmpty()) {
|
||||
qWarning() << "daemon no log path";
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "daemon log path:" << logPath;
|
||||
qDebug() << "daemon log path:" << logPath;
|
||||
if (m_daemonFileTail) {
|
||||
m_daemonFileTail->setWatchedFile(logPath);
|
||||
} else {
|
||||
m_daemonFileTail = new FileTail(logPath, this);
|
||||
connect(m_daemonFileTail, &FileTail::newLine, this, &CoreProcess::handleLogLines);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user