// // 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, const char* file, int line, const char* func) { if (level >= _level) { if (_topcall) { write_prefix(level, file, line, func); } else { _topcall = true; } std::cerr << '\n'; } } void logger::write_prefix(loglevel level, const char* file, int line, const char* func) { std::cerr << file << ":" << line << ", " << func << "() "; std::cerr << '[' << loglevel_desc(level) << "] "; }