NVIDIA Iray: Math API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::base::Log_stream Class Reference

Adapts mi::base::ILogger to a standard streaming interface. More...

+ Inheritance diagram for mi::base::Log_stream:

Public Member Functions

 Log_stream (ILogger *logger, const char *module_category, Message_severity default_level=MESSAGE_SEVERITY_INFO)
 Constructor. More...
 
 Log_stream (ILogger *logger, const std::string &module_category, Message_severity default_level=MESSAGE_SEVERITY_INFO)
 Constructor. More...
 
 ~Log_stream () throw ()
 Destructor. More...
 
void set_log_level (Message_severity level)
 Flushes the buffer if not empty, and sets the log level of the next message to the given log level. More...
 

Detailed Description

Adapts mi::base::ILogger to a standard streaming interface.

Messages are forwarded to the logger whenever the stream is flushed. The log level for the next message can be changed by using one of the manipulators fatal, error, warning, info, verbose, or debug, which correspond to the values of Message_severity. Changing the log level also triggers flushing.

Example:

mi::base::Log_stream stream( logger.get(), "APP:MAIN");
stream << "An info message" << std::flush;
stream << error << "And an error message" << std::flush;
stream << "And another info message" << std::flush;

Constructor & Destructor Documentation

mi::base::Log_stream::Log_stream ( ILogger logger,
const char *  module_category,
Message_severity  default_level = MESSAGE_SEVERITY_INFO 
)
inline

Constructor.

Parameters
loggerThe logger object used by this stream.
module_categoryThe module and the category which specify the origin and the functional area of this message. See mi::base::ILogger::message() for details.
default_levelThe default log level. Used if no other log level is selected by one of the manipulators.
mi::base::Log_stream::Log_stream ( ILogger logger,
const std::string module_category,
Message_severity  default_level = MESSAGE_SEVERITY_INFO 
)
inline

Constructor.

Parameters
loggerThe logger object used by this stream.
module_categoryThe module and the category which specify the origin and the functional area of this message. See mi::base::ILogger::message() for details.
default_levelThe default log level. Used if no other log level is selected by one of the manipulators.
mi::base::Log_stream::~Log_stream ( )
throw (
)
inline

Destructor.

Flushes the buffer.

Member Function Documentation

void mi::base::Log_stream::set_log_level ( Message_severity  level)
inline

Flushes the buffer if not empty, and sets the log level of the next message to the given log level.