refactor: remove DEBUG3 and move DEBUG3 messages to DEBUG2
This commit is contained in:
parent
2cf4fc8d0a
commit
1ed394e3ef
11 changed files with 21 additions and 24 deletions
|
|
@ -24,10 +24,10 @@
|
||||||
const int kPriorityPrefixLength = 3;
|
const int kPriorityPrefixLength = 3;
|
||||||
|
|
||||||
// names of priorities
|
// names of priorities
|
||||||
static const char *g_priority[] = {"FATAL", "ERROR", "WARNING", "NOTE", "INFO", "DEBUG", "DEBUG1", "DEBUG2", "DEBUG3"};
|
static const char *g_priority[] = {"FATAL", "ERROR", "WARNING", "NOTE", "INFO", "DEBUG", "DEBUG1", "DEBUG2"};
|
||||||
|
|
||||||
// number of priorities
|
// number of priorities
|
||||||
static const int g_numPriority = 9;
|
static const int g_numPriority = 8;
|
||||||
|
|
||||||
// if NDEBUG (not debug) is not specified, i.e. you're building in debug,
|
// if NDEBUG (not debug) is not specified, i.e. you're building in debug,
|
||||||
// then set default log level to DEBUG, otherwise the max level is INFO.
|
// then set default log level to DEBUG, otherwise the max level is INFO.
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,6 @@ otherwise it expands to a call that doesn't.
|
||||||
#define CLOG_DEBUG CLOG_TRACE "%z\065"
|
#define CLOG_DEBUG CLOG_TRACE "%z\065"
|
||||||
#define CLOG_DEBUG1 CLOG_TRACE "%z\066"
|
#define CLOG_DEBUG1 CLOG_TRACE "%z\066"
|
||||||
#define CLOG_DEBUG2 CLOG_TRACE "%z\067"
|
#define CLOG_DEBUG2 CLOG_TRACE "%z\067"
|
||||||
#define CLOG_DEBUG3 CLOG_TRACE "%z\070"
|
|
||||||
|
|
||||||
#define LOG_IPC(...) LOG((CLOG_IPC __VA_ARGS__))
|
#define LOG_IPC(...) LOG((CLOG_IPC __VA_ARGS__))
|
||||||
#define LOG_PRINT(...) LOG((CLOG_PRINT __VA_ARGS__))
|
#define LOG_PRINT(...) LOG((CLOG_PRINT __VA_ARGS__))
|
||||||
|
|
@ -221,4 +220,3 @@ otherwise it expands to a call that doesn't.
|
||||||
#define LOG_DEBUG(...) LOG((CLOG_DEBUG __VA_ARGS__))
|
#define LOG_DEBUG(...) LOG((CLOG_DEBUG __VA_ARGS__))
|
||||||
#define LOG_DEBUG1(...) LOG((CLOG_DEBUG1 __VA_ARGS__))
|
#define LOG_DEBUG1(...) LOG((CLOG_DEBUG1 __VA_ARGS__))
|
||||||
#define LOG_DEBUG2(...) LOG((CLOG_DEBUG2 __VA_ARGS__))
|
#define LOG_DEBUG2(...) LOG((CLOG_DEBUG2 __VA_ARGS__))
|
||||||
#define LOG_DEBUG3(...) LOG((CLOG_DEBUG3 __VA_ARGS__))
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,5 @@ enum class LogLevel
|
||||||
Info, //!< For informational messages
|
Info, //!< For informational messages
|
||||||
Debug, //!< For important debugging messages
|
Debug, //!< For important debugging messages
|
||||||
Debug1, //!< For verbosity +1 debugging messages
|
Debug1, //!< For verbosity +1 debugging messages
|
||||||
Debug2, //!< For verbosity +2 debugging messages
|
Debug2 //!< For verbosity +2 debugging messages
|
||||||
Debug3 //!< For verbosity +3 debugging messages
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ void KeyMap::addKeyEntry(const KeyItem &item)
|
||||||
// add item list
|
// add item list
|
||||||
entries.push_back(items);
|
entries.push_back(items);
|
||||||
LOG(
|
LOG(
|
||||||
(CLOG_DEBUG3 "add key: %04x %d %03x %04x (%04x %04x %04x)%s", newItem.m_id, newItem.m_group, newItem.m_button,
|
(CLOG_DEBUG2 "add key: %04x %d %03x %04x (%04x %04x %04x)%s", newItem.m_id, newItem.m_group, newItem.m_button,
|
||||||
newItem.m_client, newItem.m_required, newItem.m_sensitive, newItem.m_generates, newItem.m_dead ? " dead" : "")
|
newItem.m_client, newItem.m_required, newItem.m_sensitive, newItem.m_generates, newItem.m_dead ? " dead" : "")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -535,7 +535,7 @@ void MSWindowsScreen::saveMousePosition(int32_t x, int32_t y)
|
||||||
m_xCursor = x;
|
m_xCursor = x;
|
||||||
m_yCursor = y;
|
m_yCursor = y;
|
||||||
|
|
||||||
LOG_DEBUG3("saved mouse position for next delta: %+d,%+d", x, y);
|
LOG_DEBUG2("saved mouse position for next delta: %+d,%+d", x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t MSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
|
uint32_t MSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
|
||||||
|
|
@ -883,7 +883,7 @@ bool MSWindowsScreen::onPreDispatch(HWND hwnd, UINT message, WPARAM wParam, LPAR
|
||||||
|
|
||||||
bool MSWindowsScreen::onPreDispatchPrimary(HWND, UINT message, WPARAM wParam, LPARAM lParam)
|
bool MSWindowsScreen::onPreDispatchPrimary(HWND, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
LOG_DEBUG3("handling pre-dispatch primary");
|
LOG_DEBUG2("handling pre-dispatch primary");
|
||||||
|
|
||||||
// handle event
|
// handle event
|
||||||
switch (message) {
|
switch (message) {
|
||||||
|
|
@ -1226,7 +1226,7 @@ bool MSWindowsScreen::onMouseMove(int32_t mx, int32_t my)
|
||||||
int32_t x = mx - m_xCursor;
|
int32_t x = mx - m_xCursor;
|
||||||
int32_t y = my - m_yCursor;
|
int32_t y = my - m_yCursor;
|
||||||
|
|
||||||
LOG_DEBUG3("mouse move - motion delta: %+d=(%+d - %+d),%+d=(%+d - %+d)", x, mx, m_xCursor, y, my, m_yCursor);
|
LOG_DEBUG2("mouse move - motion delta: %+d=(%+d - %+d),%+d=(%+d - %+d)", x, mx, m_xCursor, y, my, m_yCursor);
|
||||||
|
|
||||||
// ignore if the mouse didn't move or if message posted prior
|
// ignore if the mouse didn't move or if message posted prior
|
||||||
// to last mark change.
|
// to last mark change.
|
||||||
|
|
@ -1245,7 +1245,7 @@ bool MSWindowsScreen::onMouseMove(int32_t mx, int32_t my)
|
||||||
// center on the server screen. if we don't do this, then the mouse
|
// center on the server screen. if we don't do this, then the mouse
|
||||||
// will always try to return to the original entry point on the
|
// will always try to return to the original entry point on the
|
||||||
// secondary screen.
|
// secondary screen.
|
||||||
LOG_DEBUG3("centering cursor on motion: %+d,%+d", m_xCenter, m_yCenter);
|
LOG_DEBUG2("centering cursor on motion: %+d,%+d", m_xCenter, m_yCenter);
|
||||||
warpCursorNoFlush(m_xCenter, m_yCenter);
|
warpCursorNoFlush(m_xCenter, m_yCenter);
|
||||||
|
|
||||||
// examine the motion. if it's about the distance
|
// examine the motion. if it's about the distance
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ void MSWindowsWatchdog::mainLoop(const void *)
|
||||||
|
|
||||||
LOG_DEBUG("starting watchdog main loop");
|
LOG_DEBUG("starting watchdog main loop");
|
||||||
while (m_running) {
|
while (m_running) {
|
||||||
LOG_DEBUG3("locking process state mutex in watchdog main loop");
|
LOG_DEBUG2("locking process state mutex in watchdog main loop");
|
||||||
std::unique_lock lock(m_processStateMutex);
|
std::unique_lock lock(m_processStateMutex);
|
||||||
|
|
||||||
if (m_processState == Running && !m_command.empty() && !m_foreground && m_session.hasChanged()) {
|
if (m_processState == Running && !m_command.empty() && !m_foreground && m_session.hasChanged()) {
|
||||||
|
|
@ -170,11 +170,11 @@ void MSWindowsWatchdog::mainLoop(const void *)
|
||||||
|
|
||||||
switch (m_processState) {
|
switch (m_processState) {
|
||||||
case Idle:
|
case Idle:
|
||||||
LOG_DEBUG3("watchdog process state idle");
|
LOG_DEBUG2("watchdog process state idle");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case StartScheduled: {
|
case StartScheduled: {
|
||||||
LOG_DEBUG3("watchdog process start scheduled");
|
LOG_DEBUG2("watchdog process start scheduled");
|
||||||
if (m_nextStartTime.has_value() && m_nextStartTime.value() <= Arch::time()) {
|
if (m_nextStartTime.has_value() && m_nextStartTime.value() <= Arch::time()) {
|
||||||
LOG_DEBUG("start time reached, queueing process start");
|
LOG_DEBUG("start time reached, queueing process start");
|
||||||
m_processState = StartPending;
|
m_processState = StartPending;
|
||||||
|
|
@ -195,7 +195,7 @@ void MSWindowsWatchdog::mainLoop(const void *)
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case Running: {
|
case Running: {
|
||||||
LOG_DEBUG3("watchdog process in running state");
|
LOG_DEBUG2("watchdog process in running state");
|
||||||
if (!isProcessRunning()) {
|
if (!isProcessRunning()) {
|
||||||
LOG_WARN("detected application not running, pid=%d", m_process->info().dwProcessId);
|
LOG_WARN("detected application not running, pid=%d", m_process->info().dwProcessId);
|
||||||
m_processState = StartPending;
|
m_processState = StartPending;
|
||||||
|
|
@ -215,11 +215,11 @@ void MSWindowsWatchdog::mainLoop(const void *)
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_DEBUG3("unlocking process state mutex in watchdog main loop");
|
LOG_DEBUG2("unlocking process state mutex in watchdog main loop");
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
|
||||||
// Sleep for only 100ms rather than 1 second so that the service can shut down faster.
|
// Sleep for only 100ms rather than 1 second so that the service can shut down faster.
|
||||||
LOG_DEBUG3("watchdog main loop sleeping");
|
LOG_DEBUG2("watchdog main loop sleeping");
|
||||||
Arch::sleep(0.1);
|
Arch::sleep(0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -499,7 +499,7 @@ void MSWindowsWatchdog::initSasFunc()
|
||||||
|
|
||||||
void MSWindowsWatchdog::sasLoop(const void *) // NOSONAR - Thread entry point signature
|
void MSWindowsWatchdog::sasLoop(const void *) // NOSONAR - Thread entry point signature
|
||||||
{
|
{
|
||||||
LOG_DEBUG3("watchdog creating sas event");
|
LOG_DEBUG2("watchdog creating sas event");
|
||||||
|
|
||||||
if (m_sendSasFunc == nullptr) {
|
if (m_sendSasFunc == nullptr) {
|
||||||
throw std::runtime_error("SendSAS function not initialized");
|
throw std::runtime_error("SendSAS function not initialized");
|
||||||
|
|
|
||||||
|
|
@ -1681,7 +1681,7 @@ CGEventRef OSXScreen::handleCGInputEvent(CGEventTapProxy proxy, CGEventType type
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_DEBUG3("unknown quartz event type: 0x%02x", type);
|
LOG_DEBUG2("unknown quartz event type: 0x%02x", type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (screen->m_isOnScreen) {
|
if (screen->m_isOnScreen) {
|
||||||
|
|
|
||||||
|
|
@ -846,7 +846,7 @@ Display *XWindowsScreen::openDisplay(const char *displayName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// open the display
|
// open the display
|
||||||
LOG_DEBUG3("calling XOpenDisplay(\"%s\")", displayName);
|
LOG_DEBUG2("calling XOpenDisplay(\"%s\")", displayName);
|
||||||
Display *display = XOpenDisplay(displayName);
|
Display *display = XOpenDisplay(displayName);
|
||||||
if (display == nullptr) {
|
if (display == nullptr) {
|
||||||
throw ScreenUnavailableException(60.0);
|
throw ScreenUnavailableException(60.0);
|
||||||
|
|
|
||||||
|
|
@ -1609,7 +1609,7 @@ void Server::onMouseUp(ButtonID id)
|
||||||
|
|
||||||
bool Server::onMouseMovePrimary(int32_t x, int32_t y)
|
bool Server::onMouseMovePrimary(int32_t x, int32_t y)
|
||||||
{
|
{
|
||||||
LOG_DEBUG3("onMouseMovePrimary %d,%d", x, y);
|
LOG_DEBUG2("onMouseMovePrimary %d,%d", x, y);
|
||||||
|
|
||||||
// mouse move on primary (server's) screen
|
// mouse move on primary (server's) screen
|
||||||
if (m_active != m_primaryClient) {
|
if (m_active != m_primaryClient) {
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ QString sanitizeBuffer(const std::stringstream &in)
|
||||||
|
|
||||||
void LogTests::initTestCase()
|
void LogTests::initTestCase()
|
||||||
{
|
{
|
||||||
m_log.setFilter(LogLevel::Debug2);
|
m_log.setFilter(LogLevel::Debug1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogTests::printWithErrorValidOutput()
|
void LogTests::printWithErrorValidOutput()
|
||||||
|
|
@ -85,7 +85,7 @@ void LogTests::printLevelToHigh()
|
||||||
std::stringstream buffer;
|
std::stringstream buffer;
|
||||||
std::streambuf *old = std::cout.rdbuf(buffer.rdbuf());
|
std::streambuf *old = std::cout.rdbuf(buffer.rdbuf());
|
||||||
|
|
||||||
m_log.print(CLOG_DEBUG3 "test message");
|
m_log.print(CLOG_DEBUG2 "test message");
|
||||||
|
|
||||||
auto string = sanitizeBuffer(buffer);
|
auto string = sanitizeBuffer(buffer);
|
||||||
std::cout.rdbuf(old);
|
std::cout.rdbuf(old);
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ int main(int argc, char **argv)
|
||||||
arch.init();
|
arch.init();
|
||||||
|
|
||||||
Log log;
|
Log log;
|
||||||
log.setFilter(LogLevel::Debug3);
|
log.setFilter(LogLevel::Debug2);
|
||||||
|
|
||||||
::testing::GTEST_FLAG(throw_on_failure) = true;
|
::testing::GTEST_FLAG(throw_on_failure) = true;
|
||||||
testing::InitGoogleTest(&argc, argv);
|
testing::InitGoogleTest(&argc, argv);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue