feat(logger): trace_x() for verbose trace logging
This commit is contained in:
parent
a2af30a494
commit
9496e9aa22
4 changed files with 34 additions and 19 deletions
|
@ -536,7 +536,7 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::propert
|
||||||
m_log.warn("Action block not closed");
|
m_log.warn("Action block not closed");
|
||||||
m_log.warn("action.command = %s", action.command);
|
m_log.warn("action.command = %s", action.command);
|
||||||
} else {
|
} else {
|
||||||
m_log.trace("bar: Action details (button = %i, start_x = %i, end_x = %i, command = '%s')",
|
m_log.trace_x("bar: Action details (button = %i, start_x = %i, end_x = %i, command = '%s')",
|
||||||
static_cast<int>(action.button), action.start_x, action.end_x, action.command);
|
static_cast<int>(action.button), action.start_x, action.end_x, action.command);
|
||||||
#if DEBUG and DRAW_CLICKABLE_AREA_HINTS
|
#if DEBUG and DRAW_CLICKABLE_AREA_HINTS
|
||||||
m_log.info("Drawing clickable area hints");
|
m_log.info("Drawing clickable area hints");
|
||||||
|
@ -587,32 +587,33 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::propert
|
||||||
|
|
||||||
std::lock_guard<threading_util::spin_lock> lck(m_lock);
|
std::lock_guard<threading_util::spin_lock> lck(m_lock);
|
||||||
{
|
{
|
||||||
m_log.trace("bar: Received button press event: %i at pos(%i, %i)",
|
m_log.trace_x("bar: Received button press event: %i at pos(%i, %i)",
|
||||||
static_cast<int>(evt->detail), evt->event_x, evt->event_y);
|
static_cast<int>(evt->detail), evt->event_x, evt->event_y);
|
||||||
|
|
||||||
mousebtn button = static_cast<mousebtn>(evt->detail);
|
mousebtn button = static_cast<mousebtn>(evt->detail);
|
||||||
|
|
||||||
for (auto&& action : m_actions) {
|
for (auto&& action : m_actions) {
|
||||||
if (action.active) {
|
if (action.active) {
|
||||||
m_log.trace("bar: Ignoring action: unclosed)");
|
m_log.trace_x("bar: Ignoring action: unclosed)");
|
||||||
continue;
|
continue;
|
||||||
} else if (action.button != button) {
|
} else if (action.button != button) {
|
||||||
m_log.trace("bar: Ignoring action: button mismatch");
|
m_log.trace_x("bar: Ignoring action: button mismatch");
|
||||||
continue;
|
continue;
|
||||||
} else if (action.start_x > evt->event_x) {
|
} else if (action.start_x > evt->event_x) {
|
||||||
m_log.trace(
|
m_log.trace_x(
|
||||||
"bar: Ignoring action: start_x(%i) > event_x(%i)", action.start_x, evt->event_x);
|
"bar: Ignoring action: start_x(%i) > event_x(%i)", action.start_x, evt->event_x);
|
||||||
continue;
|
continue;
|
||||||
} else if (action.end_x < evt->event_x) {
|
} else if (action.end_x < evt->event_x) {
|
||||||
m_log.trace("bar: Ignoring action: end_x(%i) < event_x(%i)", action.end_x, evt->event_x);
|
m_log.trace_x(
|
||||||
|
"bar: Ignoring action: end_x(%i) < event_x(%i)", action.end_x, evt->event_x);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.info("Found matching input area");
|
m_log.info("Found matching input area");
|
||||||
m_log.trace("action.command = %s", action.command);
|
m_log.trace("action.command = %s", action.command);
|
||||||
m_log.trace("action.button = %i", static_cast<int>(action.button));
|
m_log.trace_x("action.button = %i", static_cast<int>(action.button));
|
||||||
m_log.trace("action.start_x = %i", action.start_x);
|
m_log.trace_x("action.start_x = %i", action.start_x);
|
||||||
m_log.trace("action.end_x = %i", action.end_x);
|
m_log.trace_x("action.end_x = %i", action.end_x);
|
||||||
|
|
||||||
if (g_signals::bar::action_click)
|
if (g_signals::bar::action_click)
|
||||||
g_signals::bar::action_click(action.command);
|
g_signals::bar::action_click(action.command);
|
||||||
|
@ -678,7 +679,7 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::propert
|
||||||
void on_alignment_change(alignment align) { //{{{
|
void on_alignment_change(alignment align) { //{{{
|
||||||
if (align == m_bar.align)
|
if (align == m_bar.align)
|
||||||
return;
|
return;
|
||||||
m_log.trace("bar: alignment_change(%i)", static_cast<int>(align));
|
m_log.trace_x("bar: alignment_change(%i)", static_cast<int>(align));
|
||||||
m_bar.align = align;
|
m_bar.align = align;
|
||||||
|
|
||||||
if (align == alignment::LEFT) {
|
if (align == alignment::LEFT) {
|
||||||
|
@ -697,7 +698,7 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::propert
|
||||||
int val{static_cast<int>(attr)};
|
int val{static_cast<int>(attr)};
|
||||||
if ((m_attributes & val) != 0)
|
if ((m_attributes & val) != 0)
|
||||||
return;
|
return;
|
||||||
m_log.trace("bar: attribute_set(%i)", val);
|
m_log.trace_x("bar: attribute_set(%i)", val);
|
||||||
m_attributes |= val;
|
m_attributes |= val;
|
||||||
} //}}}
|
} //}}}
|
||||||
|
|
||||||
|
@ -708,7 +709,7 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::propert
|
||||||
int val{static_cast<int>(attr)};
|
int val{static_cast<int>(attr)};
|
||||||
if ((m_attributes & val) == 0)
|
if ((m_attributes & val) == 0)
|
||||||
return;
|
return;
|
||||||
m_log.trace("bar: attribute_unset(%i)", val);
|
m_log.trace_x("bar: attribute_unset(%i)", val);
|
||||||
m_attributes ^= val;
|
m_attributes ^= val;
|
||||||
} //}}}
|
} //}}}
|
||||||
|
|
||||||
|
@ -717,7 +718,7 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::propert
|
||||||
*/
|
*/
|
||||||
void on_attribute_toggle(attribute attr) { //{{{
|
void on_attribute_toggle(attribute attr) { //{{{
|
||||||
int val{static_cast<int>(attr)};
|
int val{static_cast<int>(attr)};
|
||||||
m_log.trace("bar: attribute_toggle(%i)", val);
|
m_log.trace_x("bar: attribute_toggle(%i)", val);
|
||||||
m_attributes ^= val;
|
m_attributes ^= val;
|
||||||
} //}}}
|
} //}}}
|
||||||
|
|
||||||
|
@ -727,7 +728,7 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::propert
|
||||||
void on_action_block_open(mousebtn btn, string cmd) { //{{{
|
void on_action_block_open(mousebtn btn, string cmd) { //{{{
|
||||||
if (btn == mousebtn::NONE)
|
if (btn == mousebtn::NONE)
|
||||||
btn = mousebtn::LEFT;
|
btn = mousebtn::LEFT;
|
||||||
m_log.trace("bar: action_block_open(%i, %s)", static_cast<int>(btn), cmd);
|
m_log.trace_x("bar: action_block_open(%i, %s)", static_cast<int>(btn), cmd);
|
||||||
action_block action;
|
action_block action;
|
||||||
action.active = true;
|
action.active = true;
|
||||||
action.align = m_bar.align;
|
action.align = m_bar.align;
|
||||||
|
@ -741,7 +742,7 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::propert
|
||||||
* Handle action block end
|
* Handle action block end
|
||||||
*/
|
*/
|
||||||
void on_action_block_close(mousebtn btn) { //{{{
|
void on_action_block_close(mousebtn btn) { //{{{
|
||||||
m_log.trace("bar: action_block_close(%i)", static_cast<int>(btn));
|
m_log.trace_x("bar: action_block_close(%i)", static_cast<int>(btn));
|
||||||
|
|
||||||
for (auto i = m_actions.size(); i > 0; i--) {
|
for (auto i = m_actions.size(); i > 0; i--) {
|
||||||
auto& action = m_actions[i - 1];
|
auto& action = m_actions[i - 1];
|
||||||
|
@ -776,7 +777,7 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::propert
|
||||||
* Handle color change
|
* Handle color change
|
||||||
*/
|
*/
|
||||||
void on_color_change(gc gc_, color color_) { //{{{
|
void on_color_change(gc gc_, color color_) { //{{{
|
||||||
m_log.trace(
|
m_log.trace_x(
|
||||||
"bar: color_change(%i, %s -> %s)", static_cast<int>(gc_), color_.hex(), color_.rgb());
|
"bar: color_change(%i, %s -> %s)", static_cast<int>(gc_), color_.hex(), color_.rgb());
|
||||||
|
|
||||||
const uint32_t value_list[32]{color_.value()};
|
const uint32_t value_list[32]{color_.value()};
|
||||||
|
@ -790,7 +791,7 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::propert
|
||||||
* Handle font change
|
* Handle font change
|
||||||
*/
|
*/
|
||||||
void on_font_change(int index) { //{{{
|
void on_font_change(int index) { //{{{
|
||||||
m_log.trace("bar: font_change(%i)", index);
|
m_log.trace_x("bar: font_change(%i)", index);
|
||||||
m_fontmanager->set_preferred_font(index);
|
m_fontmanager->set_preferred_font(index);
|
||||||
} //}}}
|
} //}}}
|
||||||
|
|
||||||
|
@ -798,7 +799,7 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::propert
|
||||||
* Handle pixel offsetting
|
* Handle pixel offsetting
|
||||||
*/
|
*/
|
||||||
void on_pixel_offset(int px) { //{{{
|
void on_pixel_offset(int px) { //{{{
|
||||||
m_log.trace("bar: pixel_offset(%i)", px);
|
m_log.trace_x("bar: pixel_offset(%i)", px);
|
||||||
draw_shift(m_xpos, px);
|
draw_shift(m_xpos, px);
|
||||||
m_xpos += px;
|
m_xpos += px;
|
||||||
} //}}}
|
} //}}}
|
||||||
|
|
|
@ -88,6 +88,18 @@ class logger {
|
||||||
void trace(string, Args...) const {}
|
void trace(string, Args...) const {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output extra verbose trace message
|
||||||
|
*/
|
||||||
|
template <typename... Args>
|
||||||
|
#ifdef ENABLE_VERBOSE_TRACELOG
|
||||||
|
void trace_x(string message, Args... args) const {
|
||||||
|
output(loglevel::TRACE, message, args...);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
void trace_x(string, Args...) const {}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Output an info message
|
* Output an info message
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#cmakedefine DISABLE_TRAY
|
#cmakedefine DISABLE_TRAY
|
||||||
#cmakedefine DISABLE_DRAW
|
#cmakedefine DISABLE_DRAW
|
||||||
|
|
||||||
|
#cmakedefine ENABLE_VERBOSE_TRACELOG
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#cmakedefine01 DRAW_CLICKABLE_AREA_HINTS
|
#cmakedefine01 DRAW_CLICKABLE_AREA_HINTS
|
||||||
#cmakedefine DRAW_CLICKABLE_AREA_HINTS_OFFSET_Y @DRAW_CLICKABLE_AREA_HINTS_OFFSET_Y@
|
#cmakedefine DRAW_CLICKABLE_AREA_HINTS_OFFSET_Y @DRAW_CLICKABLE_AREA_HINTS_OFFSET_Y@
|
||||||
|
|
|
@ -514,7 +514,7 @@ namespace modules {
|
||||||
|
|
||||||
while (CONST_MOD(Impl).enabled()) {
|
while (CONST_MOD(Impl).enabled()) {
|
||||||
for (auto&& w : watches) {
|
for (auto&& w : watches) {
|
||||||
this->m_log.trace("%s: Poll inotify watch %s", CONST_MOD(Impl).name(), w->path());
|
this->m_log.trace_x("%s: Poll inotify watch %s", CONST_MOD(Impl).name(), w->path());
|
||||||
std::lock_guard<threading_util::spin_lock> lck(this->m_updatelock);
|
std::lock_guard<threading_util::spin_lock> lck(this->m_updatelock);
|
||||||
|
|
||||||
if (w->poll(1000 / watches.size())) {
|
if (w->poll(1000 / watches.size())) {
|
||||||
|
|
Loading…
Reference in a new issue