IAP GITLAB

Commit 206e2597 authored by Ralf Ulrich's avatar Ralf Ulrich

Merge branch '393-spdlog-default-pattern-defined-twice' into 'master'

Resolve "spdlog default pattern defined twice"

Closes #393

See merge request !325
parents 424bc429 ee793168
Pipeline #3807 canceled with stages
/* /* -*-c++-*-
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
* *
* This software is distributed under the terms of the GNU General Public * This software is distributed under the terms of the GNU General Public
...@@ -21,15 +21,13 @@ namespace corsika { ...@@ -21,15 +21,13 @@ namespace corsika {
/* /*
* The default pattern for CORSIKA8 loggers. * The default pattern for CORSIKA8 loggers.
*/ */
std::string const default_pattern{"[%n:%^%-8l%$] %v"};
inline auto set_default_level(level::level_enum const minlevel) -> void { inline auto set_default_level(level::level_enum const minlevel) -> void {
spdlog::set_level(minlevel); spdlog::set_level(minlevel);
} }
template <typename TLogger> template <typename TLogger>
inline auto add_source_info(TLogger& logger) -> void { inline auto add_source_info(TLogger& logger) -> void {
logger->set_pattern("[%n:%^%-8l%$(%s:%!:%#)] %v"); logger->set_pattern(source_pattern);
} }
template <typename TLogger> template <typename TLogger>
...@@ -48,7 +46,7 @@ namespace corsika { ...@@ -48,7 +46,7 @@ namespace corsika {
// set the default C8 format // set the default C8 format
#if (!defined(_GLIBCXX_USE_CXX11_ABI) || _GLIBCXX_USE_CXX11_ABI == 1) #if (!defined(_GLIBCXX_USE_CXX11_ABI) || _GLIBCXX_USE_CXX11_ABI == 1)
logger->set_pattern(logging::default_pattern); logger->set_pattern(default_pattern);
#else #else
// special case: gcc from the software collections devtoolset // special case: gcc from the software collections devtoolset
std::string dp(default_pattern); std::string dp(default_pattern);
......
...@@ -50,6 +50,7 @@ namespace corsika { ...@@ -50,6 +50,7 @@ namespace corsika {
* The default pattern for CORSIKA8 loggers. * The default pattern for CORSIKA8 loggers.
*/ */
const std::string default_pattern{"[%n:%^%-8l%$] %v"}; const std::string default_pattern{"[%n:%^%-8l%$] %v"};
const std::string source_pattern{"[%n:%^%-8l%$(%s:%!:%#)] %v"};
/** /**
* Create a new C8-style logger. * Create a new C8-style logger.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment