mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add logger.print
This commit is contained in:
parent
3d7a9fd225
commit
3d6c1183c4
2 changed files with 12 additions and 1 deletions
|
|
@ -23,10 +23,16 @@ Logger::Logger(std::string name) : name(std::move(name)) {
|
|||
void Logger::log(
|
||||
LogLevel level, const std::string& name, const std::string& message
|
||||
) {
|
||||
if (level == LogLevel::print) {
|
||||
std::cout << "[" << name << "] " << message << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
using namespace std::chrono;
|
||||
|
||||
std::stringstream ss;
|
||||
switch (level) {
|
||||
case LogLevel::print:
|
||||
case LogLevel::debug:
|
||||
#ifdef NDEBUG
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <sstream>
|
||||
|
||||
namespace debug {
|
||||
enum class LogLevel { debug, info, warning, error };
|
||||
enum class LogLevel { print, debug, info, warning, error };
|
||||
|
||||
class Logger;
|
||||
|
||||
|
|
@ -60,5 +60,10 @@ namespace debug {
|
|||
LogMessage warning() {
|
||||
return LogMessage(this, LogLevel::warning);
|
||||
}
|
||||
|
||||
/// @brief Print-debugging tool (printed without header)
|
||||
LogMessage print() {
|
||||
return LogMessage(this, LogLevel::print);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue