YARP
Yet Another Robot Platform
yarp::os::Log Class Reference

#include <yarp/os/Log.h>

Public Types

enum  LogType : uint8_t {
  LogTypeUnknown = 0 ,
  TraceType ,
  DebugType ,
  InfoType ,
  WarningType ,
  ErrorType ,
  FatalType ,
  LogTypeReserved = 0xFF
}
 
using Predicate = bool(*)()
 
using LogCallback = void(*)(yarp::os::Log::LogType type, const char *msg, const char *file, const unsigned int line, const char *func, double systemtime, double networktime, double externaltime, const char *comp_name, const char *id)
 

Public Member Functions

 Log (const char *file, const unsigned int line, const char *func, const Predicate pred=nullptr, const LogComponent &comp=defaultLogComponent())
 
 Log (const char *file, const unsigned int line, const char *func, const std::string_view id, const Predicate pred=nullptr, const LogComponent &comp=defaultLogComponent())
 
 Log (const char *file, const unsigned int line, const char *func, const double externaltime, const Predicate pred=nullptr, const LogComponent &comp=defaultLogComponent())
 
 Log (const char *file, const unsigned int line, const char *func, const std::string_view id, const double externaltime, const Predicate pred=nullptr, const LogComponent &comp=defaultLogComponent())
 
 Log ()
 
virtual ~Log ()
 
void trace (const char *msg,...) const
 
void debug (const char *msg,...) const
 
void info (const char *msg,...) const
 
void warning (const char *msg,...) const
 
void error (const char *msg,...) const
 
void fatal (const char *msg,...) const
 
LogStream trace () const
 
LogStream debug () const
 
LogStream info () const
 
LogStream warning () const
 
LogStream error () const
 
LogStream fatal () const
 

Static Public Member Functions

static void setLogCallback (LogCallback)
 
static void setMinimumPrintLevel (LogType level)
 Set current minimum print level. More...
 
static LogType minimumPrintLevel ()
 Get current minimum print level. More...
 
static LogType defaultMinimumPrintLevel ()
 Get default minimum print level. More...
 
static void setMinimumForwardLevel (LogType level)
 Set current minimum forward level (it does nothing if forwarding is not enabled) More...
 
static LogType minimumForwardLevel ()
 Get current minimum forward level (or LogTypeReserved if forwarding is not enabled) More...
 
static LogType defaultMinimumForwardLevel ()
 Get default minimum forward level (or LogTypeReserved if forwarding is not enabled) More...
 
static void setPrintCallback (LogCallback)
 Set current print callback. More...
 
static LogCallback printCallback ()
 Get current print callback. More...
 
static LogCallback defaultPrintCallback ()
 Get default print callback. More...
 
static void setForwardCallback (LogCallback)
 Set current forward callback (it does nothing if forwarding is not enabled) More...
 
static LogCallback forwardCallback ()
 Get current forward callback (or nullptr if forwarding is not enabled) More...
 
static LogCallback defaultForwardCallback ()
 Get default forward callback (or nullptr if forwarding is not enabled) More...
 

Detailed Description

Definition at line 49 of file Log.h.

Member Typedef Documentation

◆ LogCallback

using yarp::os::Log::LogCallback = void (*)(yarp::os::Log::LogType type, const char* msg, const char* file, const unsigned int line, const char* func, double systemtime, double networktime, double externaltime, const char* comp_name, const char* id)

Definition at line 114 of file Log.h.

◆ Predicate

using yarp::os::Log::Predicate = bool(*)()

Definition at line 52 of file Log.h.

Member Enumeration Documentation

◆ LogType

enum yarp::os::Log::LogType : uint8_t
Enumerator
LogTypeUnknown 
TraceType 
DebugType 
InfoType 
WarningType 
ErrorType 
FatalType 
LogTypeReserved 

Definition at line 88 of file Log.h.

Constructor & Destructor Documentation

◆ Log() [1/5]

yarp::os::Log::Log ( const char *  file,
const unsigned int  line,
const char *  func,
const Predicate  pred = nullptr,
const LogComponent comp = defaultLogComponent() 
)

Definition at line 933 of file Log.cpp.

◆ Log() [2/5]

yarp::os::Log::Log ( const char *  file,
const unsigned int  line,
const char *  func,
const std::string_view  id,
const Predicate  pred = nullptr,
const LogComponent comp = defaultLogComponent() 
)

Definition at line 943 of file Log.cpp.

◆ Log() [3/5]

yarp::os::Log::Log ( const char *  file,
const unsigned int  line,
const char *  func,
const double  externaltime,
const Predicate  pred = nullptr,
const LogComponent comp = defaultLogComponent() 
)

Definition at line 954 of file Log.cpp.

◆ Log() [4/5]

yarp::os::Log::Log ( const char *  file,
const unsigned int  line,
const char *  func,
const std::string_view  id,
const double  externaltime,
const Predicate  pred = nullptr,
const LogComponent comp = defaultLogComponent() 
)

Definition at line 966 of file Log.cpp.

◆ Log() [5/5]

yarp::os::Log::Log ( )

Definition at line 977 of file Log.cpp.

◆ ~Log()

yarp::os::Log::~Log ( )
virtual

Definition at line 982 of file Log.cpp.

Member Function Documentation

◆ debug() [1/2]

yarp::os::LogStream yarp::os::Log::debug ( ) const

Definition at line 1031 of file Log.cpp.

◆ debug() [2/2]

void yarp::os::Log::debug ( const char *  msg,
  ... 
) const

Definition at line 1023 of file Log.cpp.

◆ defaultForwardCallback()

yarp::os::Log::LogCallback yarp::os::Log::defaultForwardCallback ( )
static

Get default forward callback (or nullptr if forwarding is not enabled)

Definition at line 907 of file Log.cpp.

◆ defaultMinimumForwardLevel()

yarp::os::Log::LogType yarp::os::Log::defaultMinimumForwardLevel ( )
static

Get default minimum forward level (or LogTypeReserved if forwarding is not enabled)

Definition at line 858 of file Log.cpp.

◆ defaultMinimumPrintLevel()

yarp::os::Log::LogType yarp::os::Log::defaultMinimumPrintLevel ( )
static

Get default minimum print level.

Definition at line 838 of file Log.cpp.

◆ defaultPrintCallback()

yarp::os::Log::LogCallback yarp::os::Log::defaultPrintCallback ( )
static

Get default print callback.

Definition at line 885 of file Log.cpp.

◆ error() [1/2]

yarp::os::LogStream yarp::os::Log::error ( ) const

Definition at line 1093 of file Log.cpp.

◆ error() [2/2]

void yarp::os::Log::error ( const char *  msg,
  ... 
) const

Definition at line 1085 of file Log.cpp.

◆ fatal() [1/2]

yarp::os::LogStream yarp::os::Log::fatal ( ) const

Definition at line 1115 of file Log.cpp.

◆ fatal() [2/2]

void yarp::os::Log::fatal ( const char *  msg,
  ... 
) const

Definition at line 1105 of file Log.cpp.

◆ forwardCallback()

yarp::os::Log::LogCallback yarp::os::Log::forwardCallback ( )
static

Get current forward callback (or nullptr if forwarding is not enabled)

Definition at line 902 of file Log.cpp.

◆ info() [1/2]

yarp::os::LogStream yarp::os::Log::info ( ) const

Definition at line 1051 of file Log.cpp.

◆ info() [2/2]

void yarp::os::Log::info ( const char *  msg,
  ... 
) const

Definition at line 1043 of file Log.cpp.

◆ minimumForwardLevel()

yarp::os::Log::LogType yarp::os::Log::minimumForwardLevel ( )
static

Get current minimum forward level (or LogTypeReserved if forwarding is not enabled)

Definition at line 853 of file Log.cpp.

◆ minimumPrintLevel()

yarp::os::Log::LogType yarp::os::Log::minimumPrintLevel ( )
static

Get current minimum print level.

Definition at line 833 of file Log.cpp.

◆ printCallback()

yarp::os::Log::LogCallback yarp::os::Log::printCallback ( )
static

Get current print callback.

Definition at line 880 of file Log.cpp.

◆ setForwardCallback()

void yarp::os::Log::setForwardCallback ( LogCallback  cb)
static

Set current forward callback (it does nothing if forwarding is not enabled)

Definition at line 895 of file Log.cpp.

◆ setLogCallback()

void yarp::os::Log::setLogCallback ( LogCallback  cb)
static

Definition at line 869 of file Log.cpp.

◆ setMinimumForwardLevel()

void yarp::os::Log::setMinimumForwardLevel ( LogType  level)
static

Set current minimum forward level (it does nothing if forwarding is not enabled)

Definition at line 846 of file Log.cpp.

◆ setMinimumPrintLevel()

void yarp::os::Log::setMinimumPrintLevel ( LogType  level)
static

Set current minimum print level.

Definition at line 828 of file Log.cpp.

◆ setPrintCallback()

void yarp::os::Log::setPrintCallback ( LogCallback  cb)
static

Set current print callback.

Definition at line 875 of file Log.cpp.

◆ trace() [1/2]

yarp::os::LogStream yarp::os::Log::trace ( ) const

Definition at line 1010 of file Log.cpp.

◆ trace() [2/2]

void yarp::os::Log::trace ( const char *  msg,
  ... 
) const

Definition at line 1002 of file Log.cpp.

◆ warning() [1/2]

yarp::os::LogStream yarp::os::Log::warning ( ) const

Definition at line 1072 of file Log.cpp.

◆ warning() [2/2]

void yarp::os::Log::warning ( const char *  msg,
  ... 
) const

Definition at line 1064 of file Log.cpp.


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