JeVois  1.22
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Loading...
Searching...
No Matches
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...
 

Namespaces

namespace  jevois
 Main namespace for all JeVois classes and functions.
 

Macros

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

Functions

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

Variables

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

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)
#define LFATAL(msg)
Convenience macro for users to print out console or syslog messages, FATAL level.
Definition Log.H:230

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

Definition at line 332 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)
std::string warnAndIgnoreException(std::string const &prefix="")
Convenience function to catch an exception, issue some LERROR (depending on type),...
Definition Log.C:236
#define LERROR(msg)
Convenience macro for users to print out console or syslog messages, ERROR level.
Definition Log.H:211

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

Definition at line 336 of file Log.H.

◆ LTHROW

#define LTHROW (   msg)
Value:
do { std::string str; { jevois::Log<LOG_ALERT>(nullptr, nullptr, &str) << msg; } \
throw std::runtime_error(str); } while (false)
Logger class.
Definition Log.H:56

Definition at line 251 of file Log.H.