Skip to content
This repository has been archived by the owner on Sep 4, 2021. It is now read-only.

Commit

Permalink
[debug] use debug channel for uncond print. Fixes MER#1431
Browse files Browse the repository at this point in the history
Signed-off-by: Denis Zalevskiy <denis@visfun.org>
  • Loading branch information
deztructor committed Nov 27, 2015
1 parent 8166130 commit 4793af9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion include/qtaround/debug.hpp
Expand Up @@ -28,7 +28,7 @@ namespace qtaround { namespace debug {
enum class Level { First_ = 1, Debug = First_, Info, Warning, Error
, Critical, Last_ = Critical };
/// compatible with syslog priorities
enum class Priority { First_ = 0, Emerg = First_, Alert, Crit
enum class Priority { First_ = 0, Emerg = First_, Always = Emerg, Alert, Crit
, Err, Warning, Notice, Info
, Debug, Last_ = Debug };

Expand All @@ -51,6 +51,7 @@ extern template struct Traits<Priority::Err>;
extern template struct Traits<Priority::Crit>;
extern template struct Traits<Priority::Alert>;
extern template struct Traits<Priority::Emerg>;
extern template struct Traits<Priority::Always>;

static inline void print(QDebug &&d)
{
Expand Down
9 changes: 8 additions & 1 deletion src/debug.cpp
Expand Up @@ -44,7 +44,7 @@ int get_priority(char const *name)
{"Err", Priority::Err},
{"Crit", Priority::Crit},
{"Alert", Priority::Alert},
{"Emerg", Priority::Emerg},
{"Emerg", Priority::Emerg}
};
auto res = -1;
if (name) {
Expand Down Expand Up @@ -117,6 +117,7 @@ template struct Traits<Priority::Err>;
template struct Traits<Priority::Crit>;
template struct Traits<Priority::Alert>;
template struct Traits<Priority::Emerg>;
template struct Traits<Priority::Always>;

template <>
QDebug Traits<Priority::Debug>::stream()
Expand Down Expand Up @@ -166,6 +167,12 @@ QDebug Traits<Priority::Emerg>::stream()
return logger.critical();
}

template <>
QDebug Traits<Priority::Always>::stream()
{
return logger.debug();
}

void level(Level level)
{
set_level(level);
Expand Down

0 comments on commit 4793af9

Please sign in to comment.