YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
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 std::mutex * getLogMutex ()
 
static void setMinimumPrintLevel (LogType level)
 Set current minimum print level.
 
static LogType minimumPrintLevel ()
 Get current minimum print level.
 
static LogType defaultMinimumPrintLevel ()
 Get default minimum print level.
 
static void setMinimumForwardLevel (LogType level)
 Set current minimum forward level (it does nothing if forwarding is not enabled)
 
static LogType minimumForwardLevel ()
 Get current minimum forward level (or LogTypeReserved if forwarding is not enabled)
 
static LogType defaultMinimumForwardLevel ()
 Get default minimum forward level (or LogTypeReserved if forwarding is not enabled)
 
static void setPrintCallback (LogCallback)
 Set current print callback.
 
static LogCallback printCallback ()
 Get current print callback.
 
static LogCallback defaultPrintCallback ()
 Get default print callback.
 
static void setForwardCallback (LogCallback)
 Set current forward callback (it does nothing if forwarding is not enabled)
 
static LogCallback forwardCallback ()
 Get current forward callback (or nullptr if forwarding is not enabled)
 
static LogCallback defaultForwardCallback ()
 Get default forward callback (or nullptr if forwarding is not enabled)
 

Detailed Description

Definition at line 50 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 121 of file Log.h.

◆ Predicate

Definition at line 53 of file Log.h.

Member Enumeration Documentation

◆ LogType

Enumerator
LogTypeUnknown 
TraceType 
DebugType 
InfoType 
WarningType 
ErrorType 
FatalType 
LogTypeReserved 

Definition at line 89 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 926 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 936 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 947 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 959 of file Log.cpp.

◆ Log() [5/5]

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

Definition at line 970 of file Log.cpp.

◆ ~Log()

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

Definition at line 975 of file Log.cpp.

Member Function Documentation

◆ debug() [1/2]

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

Definition at line 1023 of file Log.cpp.

◆ debug() [2/2]

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

Definition at line 1015 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 900 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 878 of file Log.cpp.

◆ error() [1/2]

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

Definition at line 1085 of file Log.cpp.

◆ error() [2/2]

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

Definition at line 1077 of file Log.cpp.

◆ fatal() [1/2]

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

Definition at line 1107 of file Log.cpp.

◆ fatal() [2/2]

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

Definition at line 1097 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 895 of file Log.cpp.

◆ getLogMutex()

static std::mutex * yarp::os::Log::getLogMutex ( )
inlinestatic

Definition at line 101 of file Log.h.

◆ info() [1/2]

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

Definition at line 1043 of file Log.cpp.

◆ info() [2/2]

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

Definition at line 1035 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 873 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 888 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 868 of file Log.cpp.

◆ trace() [1/2]

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

Definition at line 1002 of file Log.cpp.

◆ trace() [2/2]

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

Definition at line 994 of file Log.cpp.

◆ warning() [1/2]

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

Definition at line 1064 of file Log.cpp.

◆ warning() [2/2]

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

Definition at line 1056 of file Log.cpp.


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