Skip to content

Commit

Permalink
fix: unvail "error,fail" log output
Browse files Browse the repository at this point in the history
 due to app_error list

Log:  modify "error,fail" to unsucess in logdata
  • Loading branch information
jeffshuai committed Jul 31, 2024
1 parent 9ae5209 commit c29340b
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 21 deletions.
4 changes: 2 additions & 2 deletions deepin-system-monitor-main/3rdparty/include/closestream.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ close_stdout(void)
{
if (flush_standard_stream(stdout) != 0 && !(errno == EPIPE)) {
if (errno)
warn(_("write error"));
warn(_("write unsuccess"));
else
warnx(_("write error"));
warnx(_("write unsuccess"));
_exit(CLOSE_EXIT_CODE);
}

Expand Down
6 changes: 3 additions & 3 deletions deepin-system-monitor-main/common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ QString formatHz(quint32 freq, HzUnit base = KHz, int prec = 2);

} // namespace format

namespace error {
namespace print {

inline void print_errno(decltype(errno) e, const QString msg)

Check warning on line 149 in deepin-system-monitor-main/common/common.h

View workflow job for this annotation

GitHub Actions / cppcheck

Parameter 'msg' is passed by value. It could be passed as a const reference which is usually faster and recommended in C++.
{
qCWarning(app) << QString("Error: [%1] %2, ").arg(e).arg(strerror(e)) << msg;
qCWarning(app) << QString("unsuccess: [%1] %2, ").arg(e).arg(strerror(e)) << msg;
}

} // namespace error
} // namespace print

namespace time {

Expand Down
4 changes: 2 additions & 2 deletions deepin-system-monitor-main/dbus/dbusalarmnotify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ void DBusAlarmNotify::showAlarmNotify(QString topic, QString msg, int timeout)
QDBusMessage replyMsg = QDBusConnection::sessionBus().call(ddeNotify);

if (replyMsg.type() == QDBusMessage::ErrorMessage) {
qCWarning(app) << __FUNCTION__ << __LINE__ << ", dde notify dbus method call fail , error name :"
<< replyMsg.errorName() << " , error msg :" << replyMsg.errorMessage();
qCWarning(app) << __FUNCTION__ << __LINE__ << ", dde notify dbus method call unsuccess , unsuccess name :"
<< replyMsg.errorName() << " , unsuccess msg :" << replyMsg.errorMessage();
QString cmd = QString("gdbus call -e -d org.deepin.SystemMonitorDaemon -o /org/deepin/SystemMonitorDaemon -m org.deepin.SystemMonitorDaemon.setAlaramLastTimeInterval 0");
QProcess::startDetached(cmd);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ void SystemProtectionSetting::onMessgaeSetting(QVariant value)
QDBusMessage replyMsg = QDBusConnection::sessionBus().call(showDDEControlCenterPage);

if (replyMsg.type() == QDBusMessage::ErrorMessage) {
qCWarning(app) << __FUNCTION__ << __LINE__ << ", dde control center dbus method call fail , error name :"
qCWarning(app) << __FUNCTION__ << __LINE__ << ", dde control center dbus method call unsuccess , unsuccess name :"
<< replyMsg.errorName() << " , error msg :" << replyMsg.errorMessage();
}

Expand Down Expand Up @@ -514,7 +514,7 @@ void SystemProtectionSetting::onMessgaeSetting(QVariant value)
QDBusMessage replyMsg = QDBusConnection::sessionBus().call(showDDEControlCenter);

if (replyMsg.type() == QDBusMessage::ErrorMessage) {
qCWarning(app) << __FUNCTION__ << __LINE__ << ", dde control center dbus method call fail , error name :"
qCWarning(app) << __FUNCTION__ << __LINE__ << ", dde control center dbus method call unsuccess , unsuccess name :"
<< replyMsg.errorName() << " , error msg :" << replyMsg.errorMessage();
}
}
Expand Down
3 changes: 2 additions & 1 deletion deepin-system-monitor-main/process/process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
using namespace common::alloc;
using namespace common::init;
using namespace common::core;
using namespace common::error;
using namespace common::print;
using namespace core::system;

namespace core {
Expand Down Expand Up @@ -597,6 +597,7 @@ void Process::readIO()

// scan each line
while (fgets(buf, bsiz, fp.get())) {
if (errno != 0) return;
if (!strncmp(buf, "read_bytes", 10)) {
sscanf(buf + 12, "%llu", &d->read_bytes);
} else if (!strncmp(buf, "write_bytes", 11)) {
Expand Down
2 changes: 1 addition & 1 deletion deepin-system-monitor-main/process/process_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#define PROC_PATH "/proc"

using namespace common::error;
using namespace common::print;

namespace core {
namespace process {
Expand Down
2 changes: 1 addition & 1 deletion deepin-system-monitor-main/service/service_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static bool setServiceEnable(const QString &servieName, bool enable, QString &er
}

if (!errorString.isEmpty()) {
qCWarning(app) << QString("Set service %1 failed, error %1").arg(enable ? "enable" : "disable").arg(errorString);
qCWarning(app) << QString("Set service %1 failed, unsuccess %1").arg(enable ? "enable" : "disable").arg(errorString);
return false;
} else {
qCDebug(app) << QString("Set service %1 ret: %2").arg(enable ? "enable" : "disable").arg(retMsg.value());
Expand Down
2 changes: 1 addition & 1 deletion deepin-system-monitor-main/system/cpu_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extern "C" {
#define PROC_PATH_STAT "/proc/stat"
#define PROC_PATH_CPUINFO "/proc/cpuinfo"

using namespace common::error;
using namespace common::print;
using namespace common::alloc;
using namespace common::init;
using namespace DDLog;
Expand Down
2 changes: 1 addition & 1 deletion deepin-system-monitor-main/system/diskio_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include <QScopedArrayPointer>

using namespace common::error;
using namespace common::print;
using namespace common::alloc;

namespace core {
Expand Down
2 changes: 1 addition & 1 deletion deepin-system-monitor-main/system/mem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#define PROC_PATH_MEM "/proc/meminfo"

using namespace common::error;
using namespace common::print;
using namespace common::alloc;

namespace core {
Expand Down
2 changes: 1 addition & 1 deletion deepin-system-monitor-main/system/net_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <QScopedArrayPointer>

using namespace common::error;
using namespace common::print;

namespace core {
namespace system {
Expand Down
2 changes: 1 addition & 1 deletion deepin-system-monitor-main/system/netif_packet_capture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ bool NetifPacketCapture::hasDevIP()
//获取网络IP(IPv4)
if (ioctl(sockfd, SIOCGIFADDR, &ifr) == -1) {
close(sockfd);
//qCDebug(app)<<"ioctl error!";
//qCDebug(app)<<"ioctl unsuccess!";
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion deepin-system-monitor-main/system/sys_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

using namespace common::alloc;
using namespace common::core;
using namespace common::error;
using namespace common::print;
using namespace core::system;
DCORE_USE_NAMESPACE

Expand Down
2 changes: 1 addition & 1 deletion deepin-system-monitor-plugin-popup/process/process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
using namespace common::alloc;
using namespace common::init;
using namespace common::core;
using namespace common::error;
using namespace common::print;
using namespace core::system;

namespace core {
Expand Down
2 changes: 1 addition & 1 deletion deepin-system-monitor-plugin-popup/system/cpu_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define PROC_PATH_STAT "/proc/stat"
#define PROC_PATH_CPUINFO "/proc/cpuinfo"

using namespace common::error;
using namespace common::print;
using namespace common::alloc;

namespace core {
Expand Down
5 changes: 4 additions & 1 deletion helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
// SPDX-License-Identifier: GPL-3.0-or-later

#pragma once
#include "ddlog.h"

#include <DSysInfo>
#include <QDebug>

using namespace DDLog;

namespace common{

class SystemState {
Expand Down Expand Up @@ -148,7 +151,7 @@ static inline const SystemState &systemInfo()
static SystemState *state = nullptr;
if (!state) {
const auto version = DTK_CORE_NAMESPACE::DSysInfo::majorVersion();
qInfo() << "Running desktop environment version is:" << version << ", versionNumber:" << version.toLong();
qCInfo(app) << "Running desktop environment version is:" << version << ", versionNumber:" << version.toLong();
if (!version.isEmpty() && version.toLong() <= 20) {
state = new V20SystemState();
state->updateVersion(true);
Expand Down

0 comments on commit c29340b

Please sign in to comment.