Logging Manager

The LoggingManager in NEST centralizes logging by filtering messages based on severity levels and delivering them to registered clients, ensuring thread safety with OpenMP. It enforces proper parameter usage by checking dictionary entries and supports customizable output through callback functions, such as console logging or external tools.

class LoggingManager : public nest::ManagerInterface

Public Functions

virtual void initialize(const bool) override

Prepare manager for operation.

After this method has completed, the manager should be completely initialized and “ready for action”.

See also

finalize()

Note

Initialization of any given manager may depend on other managers having been initialized before. KernelManager::initialize() is responsible for calling the initialization routines on the specific managers in correct order.

Parameters:

adjust_number_of_threads_or_rng_only – Pass true if calling from kernel_manager::change_number_of_threads() or RandomManager::get_status() to limit operations to those necessary for thread adjustment or switch or re-seeding of RNG.

virtual void finalize(const bool) override

Take down manager after operation.

After this method has completed, all dynamic data structures created by the manager shall be deallocated and containers emptied. Plain variables need not be reset.

See also

initialize()

Note

Finalization of any given manager may depend on other managers not having been finalized yet. KernelManager::finalize() is responsible for calling the initialization routines on the specific managers in correct order, i.e., the opposite order of initialize() calls.

Parameters:

adjust_number_of_threads_or_rng_only – Pass true if calling from kernel_manager::change_number_of_threads() to limit operations to those necessary for thread adjustment.

virtual void set_status(const DictionaryDatum&) override

Set the status of the manager.

See also

get_status()

virtual void get_status(DictionaryDatum&) override

Retrieve the status of the manager.

See also

set_status()

Note

This would ideally be a const function. However, some managers delay the update of internal variables up to the point where they are needed (e.g., before reporting their values to the user, or before simulate is called). An example for this pattern is the call to update_delay_extrema_() right at the beginning of ConnectionManager::get_status().

void register_logging_client(const deliver_logging_event_ptr callback)

Register a logging client.

Register a callback function that will receive all subsequent LoggingEvents. For the method signature see logging.h .

void set_logging_level(const severity_t level)

Set the logging level.

All logging messages with a lower severity will not be forwarded to the logging clients.

severity_t get_logging_level() const

Get the current logging level.

void publish_log(const severity_t, const std::string&, const std::string&, const std::string&, const size_t) const

Create a LoggingEvent.

This function creates a LoggingEvent that will be delivered to all registered logging clients, if the severity is above the set logging level. Do not use this function to do actual logging in the source code, instead use the LOG() function provided by the logging.h header in libnestutil.

void all_entries_accessed(const Dictionary&, const std::string&, const std::string&, const std::string&, const size_t) const

Implements standard behaviour for dictionary entry misses.

Use with define ALL_ENTRIES_ACCESSED.