-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement and integrate the new logger
- Loading branch information
Showing
4 changed files
with
44 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* \file src/core/log.cc | ||
* \ingroup core_log | ||
*/ | ||
|
||
#include "core/log.h" | ||
|
||
#include <iostream> | ||
|
||
namespace oshu { | ||
inline namespace core { | ||
namespace log { | ||
|
||
level priority = level::warning; | ||
|
||
/** | ||
* Dummy output stream. | ||
*/ | ||
static std::ostream devnull {nullptr}; | ||
|
||
std::ostream& logger(level priority) | ||
{ | ||
if (priority >= oshu::core::log::priority) | ||
return std::clog; | ||
else | ||
return devnull; | ||
} | ||
|
||
std::ostream& verbose() { return logger(level::verbose) << "VERBOSE: "; } | ||
std::ostream& debug() { return logger(level::debug) << "DEBUG: "; } | ||
std::ostream& info() { return logger(level::info) << "INFO: "; } | ||
std::ostream& warning() { return logger(level::warning) << "WARNING: "; } | ||
std::ostream& error() { return logger(level::error) << "ERROR: "; } | ||
std::ostream& critical() { return logger(level::critical) << "CRITICAL: "; } | ||
|
||
}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters