Move logger into util/log.h
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "ReceiverMonitor.h"
|
||||
#include "../../util/thread.h"
|
||||
#include "../../util.h"
|
||||
#include "../../util/log.h"
|
||||
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
@@ -67,11 +67,11 @@ void ReceiverMonitor::run()
|
||||
}}, {[report, path=this->_receiver->rawDevice()->hidrawPath()]
|
||||
(std::exception& e) {
|
||||
if(report.subId() == Receiver::DeviceConnection)
|
||||
log_printf(ERROR, "Failed to add device %d to receiver "
|
||||
logPrintf(ERROR, "Failed to add device %d to receiver "
|
||||
"on %s: %s", report.deviceIndex(),
|
||||
path.c_str(), e.what());
|
||||
else if(report.subId() == Receiver::DeviceDisconnection)
|
||||
log_printf(ERROR, "Failed to remove device %d from "
|
||||
logPrintf(ERROR, "Failed to remove device %d from "
|
||||
"receiver on %s: %s", report.deviceIndex()
|
||||
,path.c_str(), e.what());
|
||||
}});
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "DeviceMonitor.h"
|
||||
#include "../../util/thread.h"
|
||||
#include "../../util.h"
|
||||
#include "../../util/log.h"
|
||||
|
||||
#include <thread>
|
||||
#include <system_error>
|
||||
@@ -101,14 +101,14 @@ void DeviceMonitor::run()
|
||||
thread::spawn([this, name=devnode]() {
|
||||
this->addDevice(name);
|
||||
}, [name=devnode](std::exception& e){
|
||||
log_printf(WARN, "Error adding device %s: %s",
|
||||
logPrintf(WARN, "Error adding device %s: %s",
|
||||
name.c_str(), e.what());
|
||||
});
|
||||
else if (action == "remove")
|
||||
thread::spawn([this, name=devnode]() {
|
||||
this->removeDevice(name);
|
||||
}, [name=devnode](std::exception& e){
|
||||
log_printf(WARN, "Error removing device %s: %s",
|
||||
logPrintf(WARN, "Error removing device %s: %s",
|
||||
name.c_str(), e.what());
|
||||
});
|
||||
|
||||
@@ -160,7 +160,7 @@ void DeviceMonitor::enumerate()
|
||||
thread::spawn([this, name=devnode]() {
|
||||
this->addDevice(name);
|
||||
}, [name=devnode](std::exception& e){
|
||||
log_printf(ERROR, "Error adding device %s: %s",
|
||||
logPrintf(ERROR, "Error adding device %s: %s",
|
||||
name.c_str(), e.what());
|
||||
});
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include "../Error.h"
|
||||
#include "../hidpp/defs.h"
|
||||
#include "../dj/defs.h"
|
||||
#include "../../util.h"
|
||||
#include "../../util/log.h"
|
||||
#include "../hidpp/Report.h"
|
||||
|
||||
#include <string>
|
||||
@@ -230,7 +230,7 @@ std::vector<uint8_t> RawDevice::_respondToReport
|
||||
int RawDevice::_sendReport(const std::vector<uint8_t>& report)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_dev_io);
|
||||
if(logid::global_verbosity == LogLevel::RAWREPORT) {
|
||||
if(logid::global_loglevel == LogLevel::RAWREPORT) {
|
||||
printf("[RAWREPORT] %s OUT: ", _path.c_str());
|
||||
for(auto &i : report)
|
||||
printf("%02x ", i);
|
||||
@@ -295,7 +295,7 @@ int RawDevice::_readReport(std::vector<uint8_t>& report, std::size_t maxDataLeng
|
||||
if(0 == ret)
|
||||
throw backend::TimeoutError();
|
||||
|
||||
if(logid::global_verbosity == LogLevel::RAWREPORT) {
|
||||
if(logid::global_loglevel == LogLevel::RAWREPORT) {
|
||||
printf("[RAWREPORT] %s IN: ", _path.c_str());
|
||||
for(auto &i : report)
|
||||
printf("%02x ", i);
|
||||
|
Reference in New Issue
Block a user