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 945 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 955 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 966 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 978 of file Log.cpp.

◆ Log() [5/5]

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

Definition at line 989 of file Log.cpp.

◆ ~Log()

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

Definition at line 994 of file Log.cpp.

Member Function Documentation

◆ debug() [1/2]

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

Definition at line 1042 of file Log.cpp.

◆ debug() [2/2]

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

Definition at line 1034 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 919 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 877 of file Log.cpp.

◆ defaultMinimumPrintLevel()

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

Get default minimum print level.

Definition at line 857 of file Log.cpp.

◆ defaultPrintCallback()

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

Get default print callback.

Definition at line 897 of file Log.cpp.

◆ error() [1/2]

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

Definition at line 1104 of file Log.cpp.

◆ error() [2/2]

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

Definition at line 1096 of file Log.cpp.

◆ fatal() [1/2]

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

Definition at line 1126 of file Log.cpp.

◆ fatal() [2/2]

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

Definition at line 1116 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 914 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 1062 of file Log.cpp.

◆ info() [2/2]

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

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

◆ minimumPrintLevel()

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

Get current minimum print level.

Definition at line 852 of file Log.cpp.

◆ printCallback()

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

Get current print callback.

Definition at line 892 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 907 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 865 of file Log.cpp.

◆ setMinimumPrintLevel()

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

Set current minimum print level.

Definition at line 847 of file Log.cpp.

◆ setPrintCallback()

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

Set current print callback.

Definition at line 887 of file Log.cpp.

◆ trace() [1/2]

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

Definition at line 1021 of file Log.cpp.

◆ trace() [2/2]

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

Definition at line 1013 of file Log.cpp.

◆ warning() [1/2]

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

Definition at line 1083 of file Log.cpp.

◆ warning() [2/2]

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

Definition at line 1075 of file Log.cpp.


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