NVIDIA NvNeural SDK  2022.2
GPU inference framework for NVIDIA Nsight Deep Learning Designer
nvneural::SimpleLogger Class Reference

SimpleLogger is a basic ILogger implementation that displays to stdout. More...

#include <SimpleLogger.h>

Inheritance diagram for nvneural::SimpleLogger:
nvneural::refobj::RefObjectBase< nvneural::refobj::Implements< nvneural::ILogger > >

Public Member Functions

nvneural::NeuralResult log (VerbosityLevel verbosity, const char *format,...) noexcept final
 Logs an informational message. More...
 
nvneural::NeuralResult logError (VerbosityLevel verbosity, const char *format,...) noexcept final
 Logs an error message. More...
 
nvneural::NeuralResult logWarning (VerbosityLevel verbosity, const char *format,...) noexcept final
 Logs a warning message. More...
 
void redirectAllOutput (std::ostream &destination)
 Redirects future logger output to a new C++ ostream object. More...
 
void setVerbosity (VerbosityLevel verbosity)
 Sets the new verbosity threshold for the logger. More...
 
 SimpleLogger (VerbosityLevel verbosity)
 Creates a SimpleLogger with a default verbosity level. More...
 
VerbosityLevel verbosity () const noexcept final
 Retrieves the current verbosity level. More...
 
- Public Member Functions inherited from nvneural::refobj::RefObjectBase< nvneural::refobj::Implements< nvneural::ILogger > >
IRefObject::RefCount addRef () const noexcept
 Increment the object's reference count. More...
 
const void * queryInterface (IRefObject::TypeId interfaceId) const noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void * queryInterface (IRefObject::TypeId interfaceId) noexcept
 Retrieves a new object interface pointer. More...
 
 RefObjectBase ()
 Default constructor. Logs object creation.
 
IRefObject::RefCount release () const noexcept
 Decrements the object's reference count and destroys the object if the reference count reaches zero. More...
 

Detailed Description

SimpleLogger is a basic ILogger implementation that displays to stdout.

Logs are sent unaltered, warnings are prefixed with "WRN: ", and errors are prefixed with "ERR: ". ConverenceNG uses SimpleLogger for the majority of its command-line output.

Constructor & Destructor Documentation

◆ SimpleLogger()

SimpleLogger::SimpleLogger ( VerbosityLevel  verbosity)
explicit

Creates a SimpleLogger with a default verbosity level.

Parameters
verbosityDefault verbosity level to assign

Member Function Documentation

◆ log()

NeuralResult SimpleLogger::log ( VerbosityLevel  verbosity,
const char *  format,
  ... 
)
finalnoexcept

Logs an informational message.

Parameters
verbosityVerbosity level of the message.
formatPrintf-style format string.
Note
If verbosity is higher than the current verbosity level, this function may exit silently with a successful result.

◆ logError()

NeuralResult SimpleLogger::logError ( VerbosityLevel  verbosity,
const char *  format,
  ... 
)
finalnoexcept

Logs an error message.

Error messages indicate a serious failure has occurred and the user's workflow must stop. Recoverable or expected failures should probably be warnings, not errors.

Under normal conditions, plugins should not emit error messages at verbosity level 0.

Error messages do not necessarily have to be fatal errors and result in application exit; a failure to export a model because of insufficient disk space is a legitimate error message but would not require the model editor to exit.

Parameters
verbosityVerbosity level of the message.
formatPrintf-style format string.
Note
If verbosity is higher than the current verbosity level, this function may exit silently with a successful result.

◆ logWarning()

NeuralResult SimpleLogger::logWarning ( VerbosityLevel  verbosity,
const char *  format,
  ... 
)
finalnoexcept

Logs a warning message.

Warning messages indicate transient failures that the user should be aware of, but which did not result in failure of a major operation.

Under normal conditions, plugins should not emit warning messages at verbosity level 0.

Parameters
verbosityVerbosity level of the message.
formatPrintf-style format string.
Note
If verbosity is higher than the current verbosity level, this function may exit silently with a successful result.

◆ redirectAllOutput()

void SimpleLogger::redirectAllOutput ( std::ostream &  destination)

Redirects future logger output to a new C++ ostream object.

This method is not ABI-stable. Do not call it except from the same module that created the SimpleLogger object; other libraries might not have a compatible layout for their ostream objects.

Parameters
destinationNew destination for log messages

◆ setVerbosity()

void SimpleLogger::setVerbosity ( VerbosityLevel  verbosity)

Sets the new verbosity threshold for the logger.

Logs whose verbosity levels exceed the threshold are silently ignored.

Parameters
verbosityNew verbosity level to assign

◆ verbosity()

ILogger::VerbosityLevel SimpleLogger::verbosity ( ) const
finalnoexcept

Retrieves the current verbosity level.

Note
You should not need this function under normal circumstances. The normal log methods will exit early when logging more verbosely than the application demands. This function exists to allow you to skip expensive formatting operations (string allocations, etc.) that must be performed for the log methods' printf formatting interface.

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