mirror of
https://github.com/FairRootGroup/FairLogger.git
synced 2025-10-18 02:51:45 +00:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9a6644c931 | ||
|
27040ea292 | ||
|
6545d0efa2 | ||
|
159a21c24b | ||
|
2494a9e85a |
1
Jenkinsfile
vendored
1
Jenkinsfile
vendored
@@ -63,6 +63,7 @@ pipeline{
|
|||||||
[os: 'fedora', ver: '33', arch: 'x86_64', compiler: 'gcc-10'],
|
[os: 'fedora', ver: '33', arch: 'x86_64', compiler: 'gcc-10'],
|
||||||
[os: 'fedora', ver: '34', arch: 'x86_64', compiler: 'gcc-11'],
|
[os: 'fedora', ver: '34', arch: 'x86_64', compiler: 'gcc-11'],
|
||||||
[os: 'macos', ver: '11', arch: 'x86_64', compiler: 'apple-clang-12'],
|
[os: 'macos', ver: '11', arch: 'x86_64', compiler: 'apple-clang-12'],
|
||||||
|
[os: 'macos', ver: '11', arch: 'arm64', compiler: 'apple-clang-13'],
|
||||||
])
|
])
|
||||||
|
|
||||||
parallel(builds)
|
parallel(builds)
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <cstdio> // printf
|
#include <cstdio> // printf
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <iterator> // std::back_inserter
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@@ -160,27 +161,27 @@ Logger::Logger(Severity severity, Verbosity verbosity, const string& file, const
|
|||||||
for (const auto info : spec.fInfos) {
|
for (const auto info : spec.fInfos) {
|
||||||
switch (info) {
|
switch (info) {
|
||||||
case VSpec::Info::process_name:
|
case VSpec::Info::process_name:
|
||||||
fmt::format_to(fBWPrefix, "[{}]", fInfos.process_name);
|
fmt::format_to(std::back_inserter(fBWPrefix), "[{}]", fInfos.process_name);
|
||||||
break;
|
break;
|
||||||
case VSpec::Info::timestamp_us:
|
case VSpec::Info::timestamp_us:
|
||||||
FillTimeInfos();
|
FillTimeInfos();
|
||||||
fmt::format_to(fBWPrefix, "[{:%H:%M:%S}.{:06}]", fmt::localtime(fInfos.timestamp), fInfos.us.count());
|
fmt::format_to(std::back_inserter(fBWPrefix), "[{:%H:%M:%S}.{:06}]", fmt::localtime(fInfos.timestamp), fInfos.us.count());
|
||||||
break;
|
break;
|
||||||
case VSpec::Info::timestamp_s:
|
case VSpec::Info::timestamp_s:
|
||||||
FillTimeInfos();
|
FillTimeInfos();
|
||||||
fmt::format_to(fBWPrefix, "[{:%H:%M:%S}]", fmt::localtime(fInfos.timestamp));
|
fmt::format_to(std::back_inserter(fBWPrefix), "[{:%H:%M:%S}]", fmt::localtime(fInfos.timestamp));
|
||||||
break;
|
break;
|
||||||
case VSpec::Info::severity:
|
case VSpec::Info::severity:
|
||||||
fmt::format_to(fBWPrefix, "[{}]", fInfos.severity_name);
|
fmt::format_to(std::back_inserter(fBWPrefix), "[{}]", fInfos.severity_name);
|
||||||
break;
|
break;
|
||||||
case VSpec::Info::file_line_function:
|
case VSpec::Info::file_line_function:
|
||||||
fmt::format_to(fBWPrefix, "[{}:{}:{}]", fInfos.file, fInfos.line, fInfos.func);
|
fmt::format_to(std::back_inserter(fBWPrefix), "[{}:{}:{}]", fInfos.file, fInfos.line, fInfos.func);
|
||||||
break;
|
break;
|
||||||
case VSpec::Info::file_line:
|
case VSpec::Info::file_line:
|
||||||
fmt::format_to(fBWPrefix, "[{}:{}]", fInfos.file, fInfos.line);
|
fmt::format_to(std::back_inserter(fBWPrefix), "[{}:{}]", fInfos.file, fInfos.line);
|
||||||
break;
|
break;
|
||||||
case VSpec::Info::file:
|
case VSpec::Info::file:
|
||||||
fmt::format_to(fBWPrefix, "[{}]", fInfos.file);
|
fmt::format_to(std::back_inserter(fBWPrefix), "[{}]", fInfos.file);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -188,7 +189,7 @@ Logger::Logger(Severity severity, Verbosity verbosity, const string& file, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (spec.fSize > 0) {
|
if (spec.fSize > 0) {
|
||||||
fmt::format_to(fBWPrefix, " ");
|
fmt::format_to(std::back_inserter(fBWPrefix), " ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,27 +197,27 @@ Logger::Logger(Severity severity, Verbosity verbosity, const string& file, const
|
|||||||
for (const auto info : spec.fInfos) {
|
for (const auto info : spec.fInfos) {
|
||||||
switch (info) {
|
switch (info) {
|
||||||
case VSpec::Info::process_name:
|
case VSpec::Info::process_name:
|
||||||
fmt::format_to(fColorPrefix, "[{}]", ColorOut(Color::fgBlue, fInfos.process_name));
|
fmt::format_to(std::back_inserter(fColorPrefix), "[{}]", ColorOut(Color::fgBlue, fInfos.process_name));
|
||||||
break;
|
break;
|
||||||
case VSpec::Info::timestamp_us:
|
case VSpec::Info::timestamp_us:
|
||||||
FillTimeInfos();
|
FillTimeInfos();
|
||||||
fmt::format_to(fColorPrefix, "[{}{:%H:%M:%S}.{:06}{}]", startColor(Color::fgCyan), fmt::localtime(fInfos.timestamp), fInfos.us.count(), endColor());
|
fmt::format_to(std::back_inserter(fColorPrefix), "[{}{:%H:%M:%S}.{:06}{}]", startColor(Color::fgCyan), fmt::localtime(fInfos.timestamp), fInfos.us.count(), endColor());
|
||||||
break;
|
break;
|
||||||
case VSpec::Info::timestamp_s:
|
case VSpec::Info::timestamp_s:
|
||||||
FillTimeInfos();
|
FillTimeInfos();
|
||||||
fmt::format_to(fColorPrefix, "[{}{:%H:%M:%S}{}]", startColor(Color::fgCyan), fmt::localtime(fInfos.timestamp), endColor());
|
fmt::format_to(std::back_inserter(fColorPrefix), "[{}{:%H:%M:%S}{}]", startColor(Color::fgCyan), fmt::localtime(fInfos.timestamp), endColor());
|
||||||
break;
|
break;
|
||||||
case VSpec::Info::severity:
|
case VSpec::Info::severity:
|
||||||
fmt::format_to(fColorPrefix, "[{}]", GetColoredSeverityString(fInfos.severity));
|
fmt::format_to(std::back_inserter(fColorPrefix), "[{}]", GetColoredSeverityString(fInfos.severity));
|
||||||
break;
|
break;
|
||||||
case VSpec::Info::file_line_function:
|
case VSpec::Info::file_line_function:
|
||||||
fmt::format_to(fColorPrefix, "[{}:{}:{}]", ColorOut(Color::fgBlue, fInfos.file), ColorOut(Color::fgYellow, fInfos.line), ColorOut(Color::fgBlue, fInfos.func));
|
fmt::format_to(std::back_inserter(fColorPrefix), "[{}:{}:{}]", ColorOut(Color::fgBlue, fInfos.file), ColorOut(Color::fgYellow, fInfos.line), ColorOut(Color::fgBlue, fInfos.func));
|
||||||
break;
|
break;
|
||||||
case VSpec::Info::file_line:
|
case VSpec::Info::file_line:
|
||||||
fmt::format_to(fColorPrefix, "[{}:{}]", ColorOut(Color::fgBlue, fInfos.file), ColorOut(Color::fgYellow, fInfos.line));
|
fmt::format_to(std::back_inserter(fColorPrefix), "[{}:{}]", ColorOut(Color::fgBlue, fInfos.file), ColorOut(Color::fgYellow, fInfos.line));
|
||||||
break;
|
break;
|
||||||
case VSpec::Info::file:
|
case VSpec::Info::file:
|
||||||
fmt::format_to(fColorPrefix, "[{}]", ColorOut(Color::fgBlue, fInfos.file));
|
fmt::format_to(std::back_inserter(fColorPrefix), "[{}]", ColorOut(Color::fgBlue, fInfos.file));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -224,7 +225,7 @@ Logger::Logger(Severity severity, Verbosity verbosity, const string& file, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (spec.fSize > 0) {
|
if (spec.fSize > 0) {
|
||||||
fmt::format_to(fColorPrefix, " ");
|
fmt::format_to(std::back_inserter(fColorPrefix), " ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
#include <fmt/printf.h>
|
#include <fmt/printf.h>
|
||||||
|
#include <fmt/ostream.h>
|
||||||
|
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
@@ -68,19 +69,19 @@ enum class Severity : int
|
|||||||
// aliases
|
// aliases
|
||||||
warning = warn,
|
warning = warn,
|
||||||
// backwards-compatibility
|
// backwards-compatibility
|
||||||
NOLOG [[deprecated("Use 'nolog' instead")]] = nolog,
|
NOLOG __attribute__((deprecated("Use LOG(nolog) instead (lowercase severity name)."))) = nolog,
|
||||||
TRACE [[deprecated("Use 'trace' instead")]] = trace,
|
FATAL __attribute__((deprecated("Use LOG(fatal) instead (lowercase severity name)."))) = fatal,
|
||||||
DEBUG4 [[deprecated("Use 'debug4' instead")]] = debug4,
|
ERROR __attribute__((deprecated("Use LOG(error) instead (lowercase severity name)."))) = error,
|
||||||
DEBUG3 [[deprecated("Use 'debug3' instead")]] = debug3,
|
WARN __attribute__((deprecated("Use LOG(warn) instead (lowercase severity name)."))) = warn,
|
||||||
DEBUG2 [[deprecated("Use 'debug2' instead")]] = debug2,
|
WARNING __attribute__((deprecated("Use LOG(warning) instead (lowercase severity name)."))) = warn,
|
||||||
DEBUG1 [[deprecated("Use 'debug1' instead")]] = debug1,
|
STATE __attribute__((deprecated("Use LOG(state) instead (lowercase severity name)."))) = state,
|
||||||
DEBUG [[deprecated("Use 'debug' instead")]] = debug,
|
INFO __attribute__((deprecated("Use LOG(info) instead (lowercase severity name)."))) = info,
|
||||||
INFO [[deprecated("Use 'info' instead")]] = info,
|
DEBUG __attribute__((deprecated("Use LOG(debug) instead (lowercase severity name)."))) = debug,
|
||||||
STATE [[deprecated("Use 'state' instead")]] = state,
|
DEBUG1 __attribute__((deprecated("Use LOG(debug1) instead (lowercase severity name)."))) = debug1,
|
||||||
WARNING [[deprecated("Use 'warning' instead")]] = warn,
|
DEBUG2 __attribute__((deprecated("Use LOG(debug2) instead (lowercase severity name)."))) = debug2,
|
||||||
WARN [[deprecated("Use 'warn' instead")]] = warn,
|
DEBUG3 __attribute__((deprecated("Use LOG(debug3) instead (lowercase severity name)."))) = debug3,
|
||||||
ERROR [[deprecated("Use 'error' instead")]] = error,
|
DEBUG4 __attribute__((deprecated("Use LOG(debug4) instead (lowercase severity name)."))) = debug4,
|
||||||
FATAL [[deprecated("Use 'fatal' instead")]] = fatal
|
TRACE __attribute__((deprecated("Use LOG(trace) instead (lowercase severity name)."))) = trace
|
||||||
};
|
};
|
||||||
|
|
||||||
// verbosity levels:
|
// verbosity levels:
|
||||||
|
Reference in New Issue
Block a user