Sha256: 41ad84e8b1bb1472dd12814d6ed23d03626cf89f5876582b0727b819906bfc41
Contents?: true
Size: 1.1 KB
Versions: 16
Compression:
Stored size: 1.1 KB
Contents
#include <leatherman/logging/logging.hpp> #include <boost/nowide/iostream.hpp> #include <unistd.h> using namespace std; namespace leatherman { namespace logging { void colorize(ostream& dst, log_level level) { if (!get_colorization()) { return; } static const string cyan = "\33[0;36m"; static const string green = "\33[0;32m"; static const string yellow = "\33[0;33m"; static const string red = "\33[0;31m"; static const string reset = "\33[0m"; if (level == log_level::trace || level == log_level::debug) { dst << cyan; } else if (level == log_level::info) { dst << green; } else if (level == log_level::warning) { dst << yellow; } else if (level == log_level::error || level == log_level::fatal) { dst << red; } else { dst << reset; } } bool color_supported(ostream& dst) { return (&dst == &cout && isatty(fileno(stdout))) || (&dst == &cerr && isatty(fileno(stderr))); } }} // namespace leatherman::logging
Version data entries
16 entries across 16 versions & 2 rubygems