Skip to main content

DPF C++ Client Library 2025 R2

ansys::dpf::core::logging::Logger Class Reference

Last update: 16.07.2025

Logger interface. All public methods are thread-safe. More...

#include <dpf_api.h>

Public Member Functions

bool valid () const
 Returns if the logger is valid. By design, the logging API will never error and there could be situations where a non-functional Logger instance will be returned. E.g if trying to register a logger with a name that is already registered or with an invalid name, or get a logger with a name which does not exist or is invalid. If the Logger is invalid, all method calls like flush() or log() will be NOPs. More...
 
std::string name () const
 Return the name of the Logger. More...
 
void flush ()
 Flush all logger messages to the active sinks.
 
template<typename T >
void trace (T const &message)
 Logs a message with the trace loglevel. More...
 
template<typename T >
void debug (T const &message)
 Logs a message with the debug loglevel. More...
 
template<typename T >
void info (T const &message)
 Logs a message with the info loglevel. More...
 
template<typename T >
void warning (T const &message)
 Logs a message with the warning loglevel. More...
 
template<typename T >
void error (T const &message)
 Logs a message with the error loglevel. More...
 
template<typename T >
void critical (T const &message)
 Logs a message with the critical loglevel. More...
 
template<typename T >
void log (T const &message, eLogLevel loglevel)
 Logs a message with the critical loglevel. More...
 

Detailed Description

Logger interface. All public methods are thread-safe.

Member Function Documentation

◆ critical()

template<typename T >
void ansys::dpf::core::logging::Logger::critical ( T const &  message)
inline

Logs a message with the critical loglevel.

Parameters
messageThe string to be logged.

◆ debug()

template<typename T >
void ansys::dpf::core::logging::Logger::debug ( T const &  message)
inline

Logs a message with the debug loglevel.

Parameters
messageThe string to be logged.

◆ error()

template<typename T >
void ansys::dpf::core::logging::Logger::error ( T const &  message)
inline

Logs a message with the error loglevel.

Parameters
messageThe string to be logged.

◆ info()

template<typename T >
void ansys::dpf::core::logging::Logger::info ( T const &  message)
inline

Logs a message with the info loglevel.

Parameters
messageThe string to be logged.

◆ log()

template<typename T >
void ansys::dpf::core::logging::Logger::log ( T const &  message,
eLogLevel  loglevel 
)
inline

Logs a message with the critical loglevel.

Parameters
messageThe string to be logged.

◆ name()

std::string ansys::dpf::core::logging::Logger::name ( ) const

Return the name of the Logger.

Returns
std::string

◆ trace()

template<typename T >
void ansys::dpf::core::logging::Logger::trace ( T const &  message)
inline

Logs a message with the trace loglevel.

Parameters
messageThe string to be logged.

◆ valid()

bool ansys::dpf::core::logging::Logger::valid ( ) const

Returns if the logger is valid. By design, the logging API will never error and there could be situations where a non-functional Logger instance will be returned. E.g if trying to register a logger with a name that is already registered or with an invalid name, or get a logger with a name which does not exist or is invalid. If the Logger is invalid, all method calls like flush() or log() will be NOPs.

Returns
std::string

◆ warning()

template<typename T >
void ansys::dpf::core::logging::Logger::warning ( T const &  message)
inline

Logs a message with the warning loglevel.

Parameters
messageThe string to be logged.

Connect with Ansys