reference

This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.

ofLog.cpp File Reference
#include "ofLog.h"
#include <ofUtils.h>
#include <map>

Functions

void ofSetLogLevel (ofLogLevel level)
 Sets the logging level to selectively show log messages.
 
void ofSetLogLevel (string module, ofLogLevel level)
 
ofLogLevel ofGetLogLevel ()
 Get the currently set global logging level.
 
ofLogLevel ofGetLogLevel (string module)
 
void ofLogToFile (const of::filesystem::path &path, bool append)
 Set the logging to output to a file instead of the console.
 
void ofLogToConsole ()
 Set the logging to ouptut to the console.
 
void ofSetLoggerChannel (shared_ptr< ofBaseLoggerChannel > loggerChannel)
 
shared_ptr< ofBaseLoggerChannel > ofGetLoggerChannel ()
 Get the current logger channel.
 
string ofGetLogLevelName (ofLogLevel level, bool pad)
 Get log level name as a string.
 

Function Documentation

◆ ofGetLoggerChannel()

shared_ptr< ofBaseLoggerChannel > ofGetLoggerChannel ( )

Get the current logger channel.

◆ ofGetLogLevel() [1/2]

ofLogLevel ofGetLogLevel ( )

Get the currently set global logging level.

Returns
The currently set global logging level.

◆ ofGetLogLevel() [2/2]

ofLogLevel ofGetLogLevel ( string  module)

◆ ofGetLogLevelName()

string ofGetLogLevelName ( ofLogLevel  level,
bool  pad = false 
)

Get log level name as a string.

Parameters
levelThe ofLogLevel you want as a string.
padTrue if you want all log level names to be the same length.
Returns
The log level name as a string.

◆ ofLogToConsole()

void ofLogToConsole ( )

Set the logging to ouptut to the console.

This is the default state and can be called to reset console logging after ofLogToFile or ofSetLoggerChannel has been called.

◆ ofLogToFile()

void ofLogToFile ( const of::filesystem::path &  path,
bool  append = false 
)

Set the logging to output to a file instead of the console.

Parameters
pathThe path to the log file to use.
appendTrue if you want to append to the existing file.

◆ ofSetLoggerChannel()

void ofSetLoggerChannel ( shared_ptr< ofBaseLoggerChannel >  loggerChannel)

◆ ofSetLogLevel() [1/2]

void ofSetLogLevel ( ofLogLevel  level)

Sets the logging level to selectively show log messages.

This is useful if you want see lots of messages when debugging, but then set a higher level so only warnings and errors appear for users.

ofLogLevel values in order from lowest to highest level are:

  • OF_LOG_VERBOSE (lowest level)
  • OF_LOG_NOTICE
  • OF_LOG_WARNING
  • OF_LOG_ERROR
  • OF_LOG_FATAL_ERROR
  • OF_LOG_SILENT (highest level)

Thus, setting a log level of OF_LOG_ERROR, means only logging messages marked OF_LOG_ERROR and OF_LOG_FATAL_ERROR will be printed. Conversely, setting OF_LOG_VERBOSE means all log level messages, including OF_LOG_VERBOSE, will be printed. Finally, setting a log level of OF_LOG_SILENT will prevent any messages from being printed.

The default ofLogLevel is OF_LOG_NOTICE.

Parameters
levelthe ofLogLevel (and below) you want to show

◆ ofSetLogLevel() [2/2]

void ofSetLogLevel ( string  module,
ofLogLevel  level 
)