Project Malmo  0.37.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Friends | List of all members
malmo::Logger Class Reference

Public Types

enum  LoggingSeverityLevel {
  LOG_OFF , LOG_ERRORS , LOG_WARNINGS , LOG_INFO ,
  LOG_FINE , LOG_TRACE , LOG_ALL
}
 Specifies the detail that will be logged, if logging is enabled.
 
enum  LoggingComponent {
  LOG_TCP = 1 , LOG_RECORDING = 2 , LOG_VIDEO = 4 , LOG_AGENTHOST = 8 ,
  LOG_OBJECTLIFETIME = 16 , LOG_ALL_COMPONENTS = 31
}
 Specifies the components that will output logging information.
 

Public Member Functions

 Logger (const malmo::Logger &)=delete
 
template<LoggingSeverityLevel level, LoggingComponent component, typename... Args>
void print (Args &&...args)
 
void setSeverityLevel (LoggingSeverityLevel level)
 
void setFilename (const std::string &file)
 
void setComponent (LoggingComponent component, bool enable_logging)
 

Static Public Member Functions

static LoggergetLogger ()
 
static void setLogging (const std::string &filename, LoggingSeverityLevel severity_level)
 Sets logging options for debugging. More...
 
static void setLoggingComponent (LoggingComponent component, bool enable_logging)
 Switches on/off logging for a particular component. All components are enabled by default. Has no effect unless logging is turned on.
 
static void appendToLog (LoggingSeverityLevel severity_level, const std::string &message)
 Add a single line to the log. More...
 

Protected Member Functions

void indent ()
 
void unindent ()
 
void clear_backlog ()
 
void performWrite (const std::string &logline)
 

Static Protected Member Functions

static void log_spooler (Logger *logger)
 

Friends

template<LoggingSeverityLevel level, Logger::LoggingComponent component>
class LogSection
 
class LoggerLifetimeTracker
 
void log_spooler (Logger *logger)
 

Member Function Documentation

◆ appendToLog()

static void malmo::Logger::appendToLog ( LoggingSeverityLevel  severity_level,
const std::string &  message 
)
inlinestatic

Add a single line to the log.

Provided for external use - swigged/bound to allow user code to add to the log, to assist in debugging. Internal (Malmo) code should use the macros instead.

Parameters
severity_levelThe level for this log line. \message The message to add to the log file.

◆ setLogging()

static void malmo::Logger::setLogging ( const std::string &  filename,
LoggingSeverityLevel  severity_level 
)
inlinestatic

Sets logging options for debugging.

Parameters
filenameA filename to output log messages to. Will use the console if this is empty / can't be written to.
severity_levelDetermine how verbose the log will be.

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