eRPC Generator (erpcgen)  Rev. 1.12.0
NXP Semiconductors
Log::SetOutputLevel Class Reference

Utility class to temporarily change the logging output level. More...

#include <Logging.hpp>

Public Member Functions

 SetOutputLevel (Logger::log_level_t level)
 Default constructor. More...
 
 SetOutputLevel (Logger *logger, Logger::log_level_t level)
 Constructor. More...
 
 ~SetOutputLevel ()
 Destructor. More...
 

Protected Attributes

Loggerm_logger
 The logger instance we're controlling.
 
Logger::log_level_t m_saved
 Original logging output level.
 

Detailed Description

Utility class to temporarily change the logging output level.

This class will change the current logging output level of a given logger instance. Then when it falls out of scope it will set the level back to what it was originally.

Use like this:

// output level is some value here
{
Log::SetOutputLevel leveler(Logger::DEBUG);
// now output level is DEBUG
Log::log("my debug message 1");
Log::log("my debug message 2");
}
// output level is restored to previous value

Constructor & Destructor Documentation

Log::SetOutputLevel::SetOutputLevel ( Logger::log_level_t  level)
inlineexplicit

Default constructor.

Saves the current logging output level of the global logger, as managed by the Log class, and sets the new level to level.

Log::SetOutputLevel::SetOutputLevel ( Logger logger,
Logger::log_level_t  level 
)
inline

Constructor.

Saves the current logging output level of logger and sets the new level to level.

Log::SetOutputLevel::~SetOutputLevel ( )
inline

Destructor.

Restores the saved logging output level.


The documentation for this class was generated from the following file: