CORSIKA  @c8_version@
The framework to simulate particle cascades for astroparticle physics
Logging.hpp File Reference

CORSIKA8 logging utilities. More...

#include <spdlog/fmt/ostr.h>
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/spdlog.h>
#include <corsika/detail/framework/core/Logging.inl>
Include dependency graph for Logging.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 corsika
 `, since they are used everywhere as integral part of the framework.
 

Macros

#define SPDLOG_CLOCK_COARSE
 
#define SPDLOG_DISABLE_DEFAULT_LOGGER
 
#define SPDLOG_FUNCTION   __PRETTY_FUNCTION__
 
#define SPDLOG_ACTIVE_LEVEL   SPDLOG_LEVEL_DEBUG
 
#define CORSIKA_LOG_TRACE   SPDLOG_TRACE
 
#define CORSIKA_LOG_DEBUG   SPDLOG_DEBUG
 
#define CORSIKA_LOG_INFO   SPDLOG_INFO
 
#define CORSIKA_LOG_WARN   SPDLOG_WARN
 
#define CORSIKA_LOG_ERROR   SPDLOG_ERROR
 
#define CORSIKA_LOG_CRITICAL   SPDLOG_CRITICAL
 
#define CORSIKA_LOGGER_TRACE   SPDLOG_LOGGER_TRACE
 
#define CORSIKA_LOGGER_DEBUG   SPDLOG_LOGGER_DEBUG
 
#define CORSIKA_LOGGER_INFO   SPDLOG_LOGGER_INFO
 
#define CORSIKA_LOGGER_WARN   SPDLOG_LOGGER_WARN
 
#define CORSIKA_LOGGER_ERROR   SPDLOG_LOGGER_ERROR
 
#define CORSIKA_LOGGER_CRITICAL   SPDLOG_LOGGER_CRITICAL
 

Functions

std::shared_ptr< spdlog::logger > corsika::create_logger (std::string const &name, bool const defaultlog=false)
 Create a new C8-style logger. More...
 
std::shared_ptr< spdlog::logger > corsika::get_logger (std::string const &name, bool const defaultlog=false)
 Get a smart pointer to an existing logger. More...
 
auto corsika::logging::set_default_level (level::level_enum const minlevel) -> void
 Set the default log level for all newly created loggers. More...
 
template<typename TLogger >
auto corsika::logging::add_source_info (TLogger &logger) -> void
 Add the source (filename, line no) info to the logger. More...
 
template<typename TLogger >
auto corsika::logging::reset_pattern (TLogger &logger) -> void
 Reset the logging pattern to the default. More...
 

Variables

const std::string corsika::minimal_pattern {"[%n:%^%-8l%$] %v"}
 
const std::string corsika::default_pattern {"[%n:%^%-8l%$(%s:%#)] %v"}
 
const std::string corsika::source_pattern {"[%n:%^%-8l%$(%s:%!:%#)] %v"}
 

Detailed Description

CORSIKA8 logging utilities.

See testLogging.cpp for a complete set of examples for how the logging functions should be used.

Definition in file Logging.hpp.

Function Documentation

◆ add_source_info()

template<typename TLogger >
auto corsika::logging::add_source_info ( TLogger &  logger) -> void

Add the source (filename, line no) info to the logger.

Parameters
loggerThe logger to set the level of.

◆ reset_pattern()

template<typename TLogger >
auto corsika::logging::reset_pattern ( TLogger &  logger) -> void

Reset the logging pattern to the default.

Parameters
loggerThe logger to set the level of.

◆ set_default_level()

auto corsika::logging::set_default_level ( level::level_enum const  minlevel) -> void

Set the default log level for all newly created loggers.

Parameters
minlevelThe minimum log level required to print.