JeVois  1.16
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Log.H File Reference
#include <sys/syslog.h>
#include <string.h>
#include <string>
#include <sstream>
#include <cstdint>
#include <mutex>
Include dependency graph for Log.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  jevois::Log< Level >
 Logger class. More...
 
class  jevois::trace::TraceObject
 Helper class for tracing, issues one message on construction, and another on destruction. More...
 
class  jevois::timed_lock_guard
 Acquire a lock object on a std::timed_mutex, or LFATAL after 1 second of waiting. More...
 

Namespaces

 jevois
 
 jevois::trace
 

Macros

#define LDEBUG(msg)
 Convenience macro for users to print out console or syslog messages, DEBUG level. More...
 
#define PLDEBUG(msg)
 Like LDEBUG but appends errno and strerror(errno), to be used when some system call fails. More...
 
#define LINFO(msg)
 Convenience macro for users to print out console or syslog messages, INFO level. More...
 
#define PLINFO(msg)
 Like LINFO but appends errno and strerror(errno), to be used when some system call fails. More...
 
#define LERROR(msg)
 Convenience macro for users to print out console or syslog messages, ERROR level. More...
 
#define PLERROR(msg)
 Like LERROR but appends errno and strerror(errno), to be used when some system call fails. More...
 
#define LFATAL(msg)
 Convenience macro for users to print out console or syslog messages, FATAL level. More...
 
#define PLFATAL(msg)
 Like LDEBUG but appends errno and strerror(errno), to be used when some system call fails. More...
 
#define JEVOIS_ASSERT(cond)
 Test whether something is true and issue an LFATAL if not. More...
 
#define JEVOIS_TRACE(level)
 Trace object. More...
 
#define JEVOIS_TIMED_LOCK(mtx)
 Helper macro to create a timed_lock_guard object. More...
 
#define JEVOIS_WAIT_FOR_FUTURE(f)
 Wait for a future to become ready, throws after 5 seconds. More...
 
#define JEVOIS_WAIT_GET_FUTURE(f)
 Wait for a future to become ready for 5 seconds, get(), warn and ignore exception, report on timeout. More...
 

Functions

void jevois::warnAndRethrowException (std::string const &prefix="")
 Convenience function to catch an exception, issue some LERROR (depending on type), and rethrow it. More...
 
std::string jevois::warnAndIgnoreException (std::string const &prefix="")
 Convenience function to catch an exception, issue some LERROR (depending on type), and ignore it. More...
 
void jevois::drawErrorImage (std::string const &errmsg, RawImage &videoerrimg)
 Display an error message into a RawImage. More...
 
void jevois::logSetEngine (Engine *e)
 Set an Engine so that all log messages will be forwarded to its serial ports. More...
 
void jevois::logEnd ()
 Terminate log service. More...
 

Variables

int jevois::logLevel = LOG_INFO
 Current log level. More...
 
int jevois::traceLevel = 0
 Current trace level. More...
 

Macro Definition Documentation

◆ JEVOIS_WAIT_FOR_FUTURE

#define JEVOIS_WAIT_FOR_FUTURE (   f)
Value:
do { if (f.valid() && f.wait_for(std::chrono::seconds(2)) == \
std::future_status::timeout) LFATAL("Timeout waiting for future " #f); } while(false)

Wait for a future to become ready, throws after 5 seconds.

Definition at line 308 of file Log.H.

◆ JEVOIS_WAIT_GET_FUTURE

#define JEVOIS_WAIT_GET_FUTURE (   f)
Value:
do { if (f.valid()) { \
if (f.wait_for(std::chrono::seconds(5)) == std::future_status::timeout) LERROR("Timeout waiting for future " #f); \
try { f.get(); } catch (...) { jevois::warnAndIgnoreException(); } } } while(false)

Wait for a future to become ready for 5 seconds, get(), warn and ignore exception, report on timeout.

Definition at line 312 of file Log.H.

LERROR
#define LERROR(msg)
Convenience macro for users to print out console or syslog messages, ERROR level.
Definition: Log.H:198
jevois::warnAndIgnoreException
std::string warnAndIgnoreException(std::string const &prefix="")
Convenience function to catch an exception, issue some LERROR (depending on type),...
Definition: Log.C:224
LFATAL
#define LFATAL(msg)
Convenience macro for users to print out console or syslog messages, FATAL level.
Definition: Log.H:217