libsclogging/logger.cpp

30 lines
515 B
C++
Raw Normal View History

//
// logger.cpp
// libsclogging
//
// Created by Bob Polis at 2020-04-29
// Copyright (c) 2020 SwiftCoder. All rights reserved.
//
#include "logger.hpp"
using namespace sc;
logger::logger(loglevel level) : _level(level) {
}
void logger::msg(loglevel level) {
if (level >= _level) {
if (_topcall) {
write_prefix();
} else {
_topcall = true;
}
std::cerr << '\n';
}
}
void logger::write_prefix() {
std::cerr << loglevel_desc(_level) << ": ";
}