Compare commits

..

9 Commits

Author SHA1 Message Date
David Rohr
6545d0efa2 Include fmt/ostream.h, needed for on the fly std::ostream usage 2021-11-15 10:52:33 +01:00
Dennis Klein
159a21c24b ci: Add macos-11-arm64 (apple-clang-13) build 2021-10-01 17:10:13 +02:00
Dennis Klein
2494a9e85a Revert "Deprecate uppercase severity names"
This reverts commit ba7da2f79a.
2021-09-21 12:54:42 +02:00
Dennis Klein
d0b109015d ci: Update envs 2021-09-10 18:54:43 +02:00
Alexey Rybalchenko
ba7da2f79a Deprecate uppercase severity names 2021-09-10 14:25:31 +02:00
Alexey Rybalchenko
1c7e7f566a Bump C++ requirement to C++14 2021-09-10 14:25:31 +02:00
Alexey Rybalchenko
b2dfdd1768 Add 'alarm' and 'important' severities 2021-09-10 14:25:31 +02:00
Christian Tacke
13ebedca3d Extract find_package2 into own File
To make it easier to share find_package2 across projects
let's move it into its own file.
2021-04-09 14:26:36 +02:00
Christian Tacke
1c43450582 bundled fmt: Fix target_compile_feature
When using the bundled fmt, the declared "INTERFACE" target
can only declare INTERFACE compile features via
target_compile_feature.
2021-04-09 14:25:10 +02:00
15 changed files with 220 additions and 208 deletions

View File

@@ -12,6 +12,7 @@ cmake_policy(VERSION 3.9...3.19)
# Project ######################################################################
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
include(FairLoggerLib)
include(FairFindPackage2)
get_git_version()
@@ -53,7 +54,7 @@ add_library(FairLogger
logger/Logger.cxx
logger/Logger.h
)
target_compile_features(FairLogger PUBLIC cxx_std_11)
target_compile_features(FairLogger PUBLIC cxx_std_14)
if(USE_BOOST_PRETTY_FUNCTION)
target_link_libraries(FairLogger PUBLIC Boost::boost)
@@ -68,7 +69,7 @@ else()
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/logger/bundled>
$<INSTALL_INTERFACE:${PROJECT_INSTALL_BUNDLEDINCDIR}>
)
target_compile_features(fmt PUBLIC cxx_std_11)
target_compile_features(fmt INTERFACE cxx_std_11)
target_compile_definitions(fmt INTERFACE FMT_HEADER_ONLY)
target_link_libraries(FairLogger PUBLIC fmt)
endif()

3
Jenkinsfile vendored
View File

@@ -59,8 +59,11 @@ pipeline{
steps{
script {
def builds = jobMatrix('alfa-ci', 'build', [
[os: 'fedora', ver: '32', 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: 'macos', ver: '11', arch: 'x86_64', compiler: 'apple-clang-12'],
[os: 'macos', ver: '11', arch: 'arm64', compiler: 'apple-clang-13'],
])
parallel(builds)

View File

@@ -96,6 +96,8 @@ where severity level is one of the following:
"info",
"state",
"warn",
"important",
"alarm",
"error",
"fatal",
```

View File

@@ -0,0 +1,102 @@
################################################################################
# Copyright (C) 2018-2021 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
# #
# This software is distributed under the terms of the #
# GNU Lesser General Public Licence (LGPL) version 3, #
# copied verbatim in the file "LICENSE" #
################################################################################
#
# find_package2(PRIVATE|PUBLIC|INTERFACE <pkgname>
# [VERSION <version>]
# [COMPONENTS <list of components>]
# [ADD_REQUIREMENTS_OF <list of dep_pgkname>]
# [any other option the native find_package supports]...)
#
# Wrapper around CMake's native find_package command to add some features and bookkeeping.
#
# The qualifier (PRIVATE|PUBLIC|INTERFACE) to the package to populate
# the variables PROJECT_[INTERFACE]_<pkgname>_([VERSION]|[COMPONENTS]|PACKAGE_DEPENDENCIES)
# accordingly. This bookkeeping information is used to print our dependency found summary
# table and to generate a part of our CMake package.
#
# When a dependending package is listed with ADD_REQUIREMENTS_OF the variables
# <dep_pkgname>_<pkgname>_VERSION|COMPONENTS are looked up to and added to the native
# VERSION (selected highest version) and COMPONENTS (deduplicated) args.
#
# COMPONENTS and VERSION args are then just passed to the native find_package.
#
macro(find_package2 qualifier pkgname)
cmake_parse_arguments(ARGS "" "VERSION" "COMPONENTS;ADD_REQUIREMENTS_OF" ${ARGN})
string(TOUPPER ${pkgname} pkgname_upper)
set(__old_cpp__ ${CMAKE_PREFIX_PATH})
set(CMAKE_PREFIX_PATH ${${pkgname_upper}_ROOT} $ENV{${pkgname_upper}_ROOT} ${CMAKE_PREFIX_PATH})
# build lists of required versions and components
unset(__required_versions__)
unset(__components__)
if(ARGS_VERSION)
list(APPEND __required_versions__ ${ARGS_VERSION})
endif()
if(ARGS_COMPONENTS)
list(APPEND __components__ ${ARGS_COMPONENTS})
endif()
if(ARGS_ADD_REQUIREMENTS_OF)
foreach(dep_pkgname IN LISTS ARGS_ADD_REQUIREMENTS_OF)
if(${dep_pkgname}_${pkgname}_VERSION)
list(APPEND __required_versions__ ${${dep_pkgname}_${pkgname}_VERSION})
endif()
if(${dep_pkgname}_${pkgname}_COMPONENTS)
list(APPEND __components__ ${${dep_pkgname}_${pkgname}_COMPONENTS})
endif()
endforeach()
endif()
# select highest required version
unset(__version__)
if(__required_versions__)
list(GET __required_versions__ 0 __version__)
foreach(v IN LISTS __required_versions__)
if(${v} VERSION_GREATER ${__version__})
set(__version__ ${v})
endif()
endforeach()
endif()
# deduplicate required component list
if(__components__)
list(REMOVE_DUPLICATES ARGS_COMPONENTS)
endif()
# call native find_package
if(__components__)
find_package(${pkgname} ${__version__} QUIET COMPONENTS ${__components__} ${ARGS_UNPARSED_ARGUMENTS})
else()
find_package(${pkgname} ${__version__} QUIET ${ARGS_UNPARSED_ARGUMENTS})
endif()
if(${pkgname}_FOUND)
if(${qualifier} STREQUAL PRIVATE)
set(PROJECT_${pkgname}_VERSION ${__version__})
set(PROJECT_${pkgname}_COMPONENTS ${ARGS_COMPONENTS})
set(PROJECT_PACKAGE_DEPENDENCIES ${PROJECT_PACKAGE_DEPENDENCIES} ${pkgname})
elseif(${qualifier} STREQUAL PUBLIC)
set(PROJECT_${pkgname}_VERSION ${__version__})
set(PROJECT_${pkgname}_COMPONENTS ${ARGS_COMPONENTS})
set(PROJECT_PACKAGE_DEPENDENCIES ${PROJECT_PACKAGE_DEPENDENCIES} ${pkgname})
set(PROJECT_INTERFACE_${pkgname}_VERSION ${__version__})
set(PROJECT_INTERFACE_${pkgname}_COMPONENTS ${ARGS_COMPONENTS})
set(PROJECT_INTERFACE_PACKAGE_DEPENDENCIES ${PROJECT_INTERFACE_PACKAGE_DEPENDENCIES} ${pkgname})
elseif(${qualifier} STREQUAL INTERFACE)
set(PROJECT_INTERFACE_${pkgname}_VERSION ${__version__})
set(PROJECT_INTERFACE_${pkgname}_COMPONENTS ${ARGS_COMPONENTS})
set(PROJECT_INTERFACE_PACKAGE_DEPENDENCIES ${PROJECT_INTERFACE_PACKAGE_DEPENDENCIES} ${pkgname})
endif()
endif()
unset(__version__)
unset(__components__)
unset(__required_versions__)
set(CMAKE_PREFIX_PATH ${__old_cpp__})
unset(__old_cpp__)
endmacro()

View File

@@ -94,7 +94,7 @@ macro(set_fairlogger_defaults)
endif()
# Handle C++ standard level
set(PROJECT_MIN_CXX_STANDARD 11)
set(PROJECT_MIN_CXX_STANDARD 14)
if(CMAKE_CXX_STANDARD LESS PROJECT_MIN_CXX_STANDARD)
message(FATAL_ERROR "A minimum CMAKE_CXX_STANDARD of ${PROJECT_MIN_CXX_STANDARD} is required.")
endif()
@@ -248,98 +248,3 @@ macro(install_cmake_package)
DESTINATION ${PACKAGE_INSTALL_DESTINATION}
)
endmacro()
#
# find_package2(PRIVATE|PUBLIC|INTERFACE <pkgname>
# [VERSION <version>]
# [COMPONENTS <list of components>]
# [ADD_REQUIREMENTS_OF <list of dep_pgkname>]
# [any other option the native find_package supports]...)
#
# Wrapper around CMake's native find_package command to add some features and bookkeeping.
#
# The qualifier (PRIVATE|PUBLIC|INTERFACE) to the package to populate
# the variables PROJECT_[INTERFACE]_<pkgname>_([VERSION]|[COMPONENTS]|PACKAGE_DEPENDENCIES)
# accordingly. This bookkeeping information is used to print our dependency found summary
# table and to generate a part of our CMake package.
#
# When a dependending package is listed with ADD_REQUIREMENTS_OF the variables
# <dep_pkgname>_<pkgname>_VERSION|COMPONENTS are looked up to and added to the native
# VERSION (selected highest version) and COMPONENTS (deduplicated) args.
#
# COMPONENTS and VERSION args are then just passed to the native find_package.
#
macro(find_package2 qualifier pkgname)
cmake_parse_arguments(ARGS "" "VERSION" "COMPONENTS;ADD_REQUIREMENTS_OF" ${ARGN})
string(TOUPPER ${pkgname} pkgname_upper)
set(__old_cpp__ ${CMAKE_PREFIX_PATH})
set(CMAKE_PREFIX_PATH ${${pkgname_upper}_ROOT} $ENV{${pkgname_upper}_ROOT} ${CMAKE_PREFIX_PATH})
# build lists of required versions and components
unset(__required_versions__)
unset(__components__)
if(ARGS_VERSION)
list(APPEND __required_versions__ ${ARGS_VERSION})
endif()
if(ARGS_COMPONENTS)
list(APPEND __components__ ${ARGS_COMPONENTS})
endif()
if(ARGS_ADD_REQUIREMENTS_OF)
foreach(dep_pkgname IN LISTS ARGS_ADD_REQUIREMENTS_OF)
if(${dep_pkgname}_${pkgname}_VERSION)
list(APPEND __required_versions__ ${${dep_pkgname}_${pkgname}_VERSION})
endif()
if(${dep_pkgname}_${pkgname}_COMPONENTS)
list(APPEND __components__ ${${dep_pkgname}_${pkgname}_COMPONENTS})
endif()
endforeach()
endif()
# select highest required version
unset(__version__)
if(__required_versions__)
list(GET __required_versions__ 0 __version__)
foreach(v IN LISTS __required_versions__)
if(${v} VERSION_GREATER ${__version__})
set(__version__ ${v})
endif()
endforeach()
endif()
# deduplicate required component list
if(__components__)
list(REMOVE_DUPLICATES ARGS_COMPONENTS)
endif()
# call native find_package
if(__components__)
find_package(${pkgname} ${__version__} QUIET COMPONENTS ${__components__} ${ARGS_UNPARSED_ARGUMENTS})
else()
find_package(${pkgname} ${__version__} QUIET ${ARGS_UNPARSED_ARGUMENTS})
endif()
if(${pkgname}_FOUND)
if(${qualifier} STREQUAL PRIVATE)
set(PROJECT_${pkgname}_VERSION ${__version__})
set(PROJECT_${pkgname}_COMPONENTS ${ARGS_COMPONENTS})
set(PROJECT_PACKAGE_DEPENDENCIES ${PROJECT_PACKAGE_DEPENDENCIES} ${pkgname})
elseif(${qualifier} STREQUAL PUBLIC)
set(PROJECT_${pkgname}_VERSION ${__version__})
set(PROJECT_${pkgname}_COMPONENTS ${ARGS_COMPONENTS})
set(PROJECT_PACKAGE_DEPENDENCIES ${PROJECT_PACKAGE_DEPENDENCIES} ${pkgname})
set(PROJECT_INTERFACE_${pkgname}_VERSION ${__version__})
set(PROJECT_INTERFACE_${pkgname}_COMPONENTS ${ARGS_COMPONENTS})
set(PROJECT_INTERFACE_PACKAGE_DEPENDENCIES ${PROJECT_INTERFACE_PACKAGE_DEPENDENCIES} ${pkgname})
elseif(${qualifier} STREQUAL INTERFACE)
set(PROJECT_INTERFACE_${pkgname}_VERSION ${__version__})
set(PROJECT_INTERFACE_${pkgname}_COMPONENTS ${ARGS_COMPONENTS})
set(PROJECT_INTERFACE_PACKAGE_DEPENDENCIES ${PROJECT_INTERFACE_PACKAGE_DEPENDENCIES} ${pkgname})
endif()
endif()
unset(__version__)
unset(__components__)
unset(__required_versions__)
set(CMAKE_PREFIX_PATH ${__old_cpp__})
unset(__old_cpp__)
endmacro()

View File

@@ -63,33 +63,35 @@ const unordered_map<string, Verbosity> Logger::fVerbosityMap =
const unordered_map<string, Severity> Logger::fSeverityMap =
{
{ "nolog", Severity::nolog },
{ "NOLOG", Severity::nolog },
{ "error", Severity::error },
{ "ERROR", Severity::error },
{ "warn", Severity::warn },
{ "WARN", Severity::warn },
{ "warning", Severity::warn },
{ "WARNING", Severity::warn },
{ "state", Severity::state },
{ "STATE", Severity::state },
{ "info", Severity::info },
{ "INFO", Severity::info },
{ "debug", Severity::debug },
{ "DEBUG", Severity::debug },
{ "debug1", Severity::debug1 },
{ "DEBUG1", Severity::debug1 },
{ "debug2", Severity::debug2 },
{ "DEBUG2", Severity::debug2 },
{ "debug3", Severity::debug3 },
{ "DEBUG3", Severity::debug3 },
{ "debug4", Severity::debug4 },
{ "DEBUG4", Severity::debug4 },
{ "trace", Severity::trace },
{ "TRACE", Severity::trace }
{ "nolog", Severity::nolog },
{ "NOLOG", Severity::nolog },
{ "error", Severity::error },
{ "ERROR", Severity::error },
{ "alarm", Severity::alarm },
{ "important", Severity::important },
{ "warn", Severity::warn },
{ "WARN", Severity::warn },
{ "warning", Severity::warn },
{ "WARNING", Severity::warn },
{ "state", Severity::state },
{ "STATE", Severity::state },
{ "info", Severity::info },
{ "INFO", Severity::info },
{ "debug", Severity::debug },
{ "DEBUG", Severity::debug },
{ "debug1", Severity::debug1 },
{ "DEBUG1", Severity::debug1 },
{ "debug2", Severity::debug2 },
{ "DEBUG2", Severity::debug2 },
{ "debug3", Severity::debug3 },
{ "DEBUG3", Severity::debug3 },
{ "debug4", Severity::debug4 },
{ "DEBUG4", Severity::debug4 },
{ "trace", Severity::trace },
{ "TRACE", Severity::trace }
};
const array<string, 12> Logger::fSeverityNames =
const array<string, 14> Logger::fSeverityNames =
{
{
"NOLOG",
@@ -102,6 +104,8 @@ const array<string, 12> Logger::fSeverityNames =
"INFO",
"STATE",
"WARN",
"IMPORTANT",
"ALARM",
"ERROR",
"FATAL"
}
@@ -278,19 +282,21 @@ void Logger::LogEmptyLine()
string Logger::GetColoredSeverityString(Severity severity)
{
switch (severity) {
case Severity::nolog: return "\033[01;39mNOLOG\033[0m"; break;
case Severity::fatal: return "\033[01;31mFATAL\033[0m"; break;
case Severity::error: return "\033[01;31mERROR\033[0m"; break;
case Severity::warn: return "\033[01;33mWARN\033[0m"; break;
case Severity::state: return "\033[01;35mSTATE\033[0m"; break;
case Severity::info: return "\033[01;32mINFO\033[0m"; break;
case Severity::debug: return "\033[01;34mDEBUG\033[0m"; break;
case Severity::debug1: return "\033[01;34mDEBUG1\033[0m"; break;
case Severity::debug2: return "\033[01;34mDEBUG2\033[0m"; break;
case Severity::debug3: return "\033[01;34mDEBUG3\033[0m"; break;
case Severity::debug4: return "\033[01;34mDEBUG4\033[0m"; break;
case Severity::trace: return "\033[01;36mTRACE\033[0m"; break;
default: return "UNKNOWN"; break;
case Severity::nolog: return "\033[01;39mNOLOG\033[0m"; break;
case Severity::fatal: return "\033[01;31mFATAL\033[0m"; break;
case Severity::error: return "\033[01;31mERROR\033[0m"; break;
case Severity::alarm: return "\033[01;33mALARM\033[0m"; break;
case Severity::important: return "\033[01;32mIMPORTANT\033[0m"; break;
case Severity::warn: return "\033[01;33mWARN\033[0m"; break;
case Severity::state: return "\033[01;35mSTATE\033[0m"; break;
case Severity::info: return "\033[01;32mINFO\033[0m"; break;
case Severity::debug: return "\033[01;34mDEBUG\033[0m"; break;
case Severity::debug1: return "\033[01;34mDEBUG1\033[0m"; break;
case Severity::debug2: return "\033[01;34mDEBUG2\033[0m"; break;
case Severity::debug3: return "\033[01;34mDEBUG3\033[0m"; break;
case Severity::debug4: return "\033[01;34mDEBUG4\033[0m"; break;
case Severity::trace: return "\033[01;36mTRACE\033[0m"; break;
default: return "UNKNOWN"; break;
}
}

View File

@@ -26,6 +26,7 @@
#include <fmt/core.h>
#include <fmt/printf.h>
#include <fmt/ostream.h>
#pragma GCC diagnostic pop
@@ -61,9 +62,13 @@ enum class Severity : int
info = 7,
state = 8,
warn = 9,
error = 10,
fatal = 11,
// backwards-compatibility:
important = 10,
alarm = 11,
error = 12,
fatal = 13,
// aliases
warning = warn,
// backwards-compatibility
NOLOG = nolog,
TRACE = trace,
DEBUG4 = debug4,
@@ -74,7 +79,6 @@ enum class Severity : int
INFO = info,
STATE = state,
WARNING = warn,
warning = warn,
WARN = warn,
ERROR = error,
FATAL = fatal
@@ -319,7 +323,7 @@ class Logger
static const std::unordered_map<std::string, Verbosity> fVerbosityMap;
static const std::unordered_map<std::string, Severity> fSeverityMap;
static const std::array<std::string, 12> fSeverityNames;
static const std::array<std::string, 14> fSeverityNames;
static const std::array<std::string, 9> fVerbosityNames;
// protection for use after static destruction took place

View File

@@ -7,24 +7,12 @@
################################################################################
function(container)
cmake_parse_arguments(ARGS "" "OS;VERSION;DOCKER_TAG;PACKAGE_SETUP_SCRIPT" "" ${ARGN})
if(ARGS_DOCKER_TAG)
set(DOCKER_TAG ${ARGS_DOCKER_TAG})
else()
set(DOCKER_TAG "${ARGS_OS}:${ARGS_VERSION}")
endif()
if(ARGS_PACKAGE_SETUP_SCRIPT)
set(PACKAGE_SETUP_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/${ARGS_PACKAGE_SETUP_SCRIPT}")
else()
set(PACKAGE_SETUP_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/setup-${ARGS_OS}.sh")
endif()
cmake_parse_arguments(ARGS "" "OS;VERSION" "" ${ARGN})
set(container "${ARGS_OS}.${ARGS_VERSION}")
set(def "${container}.def")
set(log "${container}.log")
set(target "${container}.fairlogger.sif")
set(target "${container}.sif")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/linux.def.in" ${def} @ONLY)
@@ -41,6 +29,8 @@ function(container)
set(containers ${containers} PARENT_SCOPE)
endfunction()
container(OS fedora VERSION 32)
container(OS fedora VERSION 33)
container(OS fedora VERSION 34)
add_custom_target(all-containers DEPENDS ${containers})

View File

@@ -1,8 +1,8 @@
Bootstrap: docker
From: @DOCKER_TAG@
From: @ARGS_OS@:@ARGS_VERSION@
%files
@PACKAGE_SETUP_SCRIPT@ /setup.sh
@CMAKE_CURRENT_SOURCE_DIR@/setup-@ARGS_OS@.sh /setup.sh
%post
bash /setup.sh
bash /setup.sh @ARGS_VERSION@

View File

@@ -1,8 +1,7 @@
#! /bin/bash
dnf -y update
dnf -y groupinstall "C Development Tools and Libraries"
dnf -y install binutils boost-devel cmake ca-certificates coreutils diffutils \
findutils fmt-devel gcc-c++ git hostname ninja-build patch procps python \
redhat-lsb-core sed tar wget which
dnf -y install https://alfa-ci.gsi.de/packages/rpm/fedora-$1-x86_64/fairsoft-release-dev.rpm
dnf -y install boost-devel ninja-build 'dnf-command(builddep)' libasan liblsan libtsan libubsan clang-tools-extra
dnf -y builddep fairlogger
dnf -y clean all

View File

@@ -3,18 +3,12 @@
label="$1"
jobsh="$2"
if [ -z "$ALFACI_SLURM_CPUS" ]
then
ALFACI_SLURM_CPUS=32
fi
ALFACI_SLURM_CPUS=4
if [ -z "$ALFACI_SLURM_EXTRA_OPTS" ]
then
ALFACI_SLURM_EXTRA_OPTS="--hint=compute_bound"
fi
if [ -z "$ALFACI_SLURM_TIMEOUT" ]
then
ALFACI_SLURM_TIMEOUT=30
fi
ALFACI_SLURM_TIMEOUT=10
if [ -z "$ALFACI_SLURM_QUEUE" ]
then
ALFACI_SLURM_QUEUE=main

View File

@@ -38,7 +38,7 @@ int main()
Logger::SetConsoleSeverity(Severity::fatal);
cout << "initial severity >" << Logger::GetConsoleSeverity() << "<" << endl << endl;
array<Severity, 12> severitiesUp{{ Severity::nolog, Severity::trace, Severity::debug4, Severity::debug3, Severity::debug2, Severity::debug1, Severity::debug, Severity::info, Severity::state, Severity::warn, Severity::error, Severity::fatal }};
array<Severity, 14> severitiesUp{{ Severity::nolog, Severity::trace, Severity::debug4, Severity::debug3, Severity::debug2, Severity::debug1, Severity::debug, Severity::info, Severity::state, Severity::warn, Severity::important, Severity::alarm, Severity::error, Severity::fatal }};
#ifdef FAIR_MIN_SEVERITY
for (unsigned int i = static_cast<int>(Severity::FAIR_MIN_SEVERITY); i < severitiesUp.size(); ++i) {
#else
@@ -57,7 +57,7 @@ int main()
Logger::SetConsoleSeverity(Severity::fatal);
cout << "initial severity >" << Logger::GetConsoleSeverity() << "<" << endl << endl;
array<Severity, 12> severitiesDown{{ Severity::error, Severity::warn, Severity::state, Severity::info, Severity::debug, Severity::debug1, Severity::debug2, Severity::debug3, Severity::debug4, Severity::trace, Severity::nolog, Severity::fatal }};
array<Severity, 14> severitiesDown{{ Severity::error, Severity::alarm, Severity::important, Severity::warn, Severity::state, Severity::info, Severity::debug, Severity::debug1, Severity::debug2, Severity::debug3, Severity::debug4, Severity::trace, Severity::nolog, Severity::fatal }};
#ifdef FAIR_MIN_SEVERITY
for (unsigned int i = 0; i < severitiesDown.size() - static_cast<int>(Severity::FAIR_MIN_SEVERITY) - 1; ++i) {
#else

View File

@@ -17,18 +17,20 @@ void printEverySeverity()
{
static int i = 1;
LOG(nolog) << "nolog message, counter: " << i++;
LOG(trace) << "trace message, counter: " << i++;
LOG(debug4) << "debug4 message, counter: " << i++;
LOG(debug3) << "debug3 message, counter: " << i++;
LOG(debug2) << "debug2 message, counter: " << i++;
LOG(debug1) << "debug1 message, counter: " << i++;
LOG(debug) << "debug message, counter: " << i++;
LOG(info) << "info message, counter: " << i++;
LOG(state) << "state message, counter: " << i++;
LOG(warn) << "warning message, counter: " << i++;
LOG(error) << "error message, counter: " << i++;
LOG(fatal) << "fatal message, counter: " << i++;
LOG(nolog) << "nolog message, counter: " << i++;
LOG(trace) << "trace message, counter: " << i++;
LOG(debug4) << "debug4 message, counter: " << i++;
LOG(debug3) << "debug3 message, counter: " << i++;
LOG(debug2) << "debug2 message, counter: " << i++;
LOG(debug1) << "debug1 message, counter: " << i++;
LOG(debug) << "debug message, counter: " << i++;
LOG(info) << "info message, counter: " << i++;
LOG(state) << "state message, counter: " << i++;
LOG(warn) << "warning message, counter: " << i++;
LOG(important) << "important message, counter: " << i++;
LOG(alarm) << "alarm message, counter: " << i++;
LOG(error) << "error message, counter: " << i++;
LOG(fatal) << "fatal message, counter: " << i++;
}
void printAllVerbositiesWithSeverity(Severity sev)

View File

@@ -13,17 +13,19 @@ using namespace fair;
void printEverySeverity()
{
LOG(nolog) << "nolog message, counter: ";
LOG(trace) << "trace message, counter: ";
LOG(debug4) << "debug4 message, counter: ";
LOG(debug3) << "debug3 message, counter: ";
LOG(debug2) << "debug2 message, counter: ";
LOG(debug1) << "debug1 message, counter: ";
LOG(debug) << "debug message, counter: ";
LOG(info) << "info message, counter: " ;
LOG(state) << "state message, counter: ";
LOG(warn) << "warning message, counter: ";
LOG(error) << "error message, counter: ";
LOG(nolog) << "nolog message, counter: ";
LOG(trace) << "trace message, counter: ";
LOG(debug4) << "debug4 message, counter: ";
LOG(debug3) << "debug3 message, counter: ";
LOG(debug2) << "debug2 message, counter: ";
LOG(debug1) << "debug1 message, counter: ";
LOG(debug) << "debug message, counter: ";
LOG(info) << "info message, counter: ";
LOG(state) << "state message, counter: ";
LOG(warn) << "warning message, counter: ";
LOG(important) << "important message, counter: ";
LOG(alarm) << "alarm message, counter: ";
LOG(error) << "error message, counter: ";
}
void silentlyPrintAllVerbositiesWithSeverity(Severity sev)

View File

@@ -20,18 +20,20 @@ using namespace fair::logger::test;
uint32_t printEverySeverity(uint32_t i)
{
LOG(nolog) << "nolog message, counter: " << i++;
LOG(trace) << "trace message, counter: " << i++;
LOG(debug4) << "debug4 message, counter: " << i++;
LOG(debug3) << "debug3 message, counter: " << i++;
LOG(debug2) << "debug2 message, counter: " << i++;
LOG(debug1) << "debug1 message, counter: " << i++;
LOG(debug) << "debug message, counter: " << i++;
LOG(info) << "info message, counter: " << i++;
LOG(state) << "state message, counter: " << i++;
LOG(warn) << "warning message, counter: " << i++;
LOG(error) << "error message, counter: " << i++;
LOG(fatal) << "fatal message, counter: " << i++;
LOG(nolog) << "nolog message, counter: " << i++;
LOG(trace) << "trace message, counter: " << i++;
LOG(debug4) << "debug4 message, counter: " << i++;
LOG(debug3) << "debug3 message, counter: " << i++;
LOG(debug2) << "debug2 message, counter: " << i++;
LOG(debug1) << "debug1 message, counter: " << i++;
LOG(debug) << "debug message, counter: " << i++;
LOG(info) << "info message, counter: " << i++;
LOG(state) << "state message, counter: " << i++;
LOG(warn) << "warning message, counter: " << i++;
LOG(important) << "important message, counter: " << i++;
LOG(alarm) << "alarm message, counter: " << i++;
LOG(error) << "error message, counter: " << i++;
LOG(fatal) << "fatal message, counter: " << i++;
return i;
}
@@ -45,7 +47,7 @@ void CheckSeverity(Severity severity)
for (uint32_t i = 0; i < Logger::fSeverityNames.size(); ++i) {
if (sev == Severity::nolog) {
if (i == 11) {
if (i == static_cast<int>(fair::Severity::fatal)) {
if (!Logger::Logging(static_cast<Severity>(i))) {
throw runtime_error(ToStr("expecting to be logging ", Logger::fSeverityNames.at(i), " during ", sev, ", but it is not."));
}