LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Enumerations | Functions
logs.hpp File Reference

Logging header. More...

#include <logicalaccess/plugins/llacommon/lla_common_api.hpp>
#include <logicalaccess/lla_fwd.hpp>
#include <fstream>
#include <map>
#include <sstream>
#include <vector>
#include <array>
#include <cstdint>

Go to the source code of this file.

Classes

class  logicalaccess::LogContext
 
class  logicalaccess::Logs
 
struct  logicalaccess::LogDisabler
 

Namespaces

namespace  logicalaccess
 

Macros

#define EXCEPTION(type, ...)    type(/*__FUNCTION__ "," __FILE__ "," __LINE__ " : "*/ __VA_ARGS__)
 Convenient alias to create an exception.
 
#define EXCEPTION_ASSERT(condition, type, msg)
 Assertion which raises an exception on failure.
 
#define LOG(x)   logicalaccess::Logs(__FILE__, __FUNCTION__, __LINE__, x)
 
#define TRACE(...)
 
#define LLA_LOG_CTX(param)
 
#define THROW_EXCEPTION_WITH_LOG(type, msg, ...)
 
#define EXCEPTION_ASSERT_WITH_LOG(condition, type, msg, ...)
 

Enumerations

enum  logicalaccess::LogLevel {
  logicalaccess::NONE = 0 , logicalaccess::TRACE , logicalaccess::INFOS , logicalaccess::WARNINGS ,
  logicalaccess::NOTICES , logicalaccess::ERRORS , logicalaccess::EMERGENSYS , logicalaccess::CRITICALS ,
  logicalaccess::ALERTS , logicalaccess::DEBUGS , logicalaccess::COMS , logicalaccess::PLUGINS ,
  logicalaccess::PLUGINS_ERROR
}
 

Functions

std::ostream & logicalaccess::operator<< (std::ostream &ss, const ByteVector &bytebuff)
 
std::ostream & logicalaccess::operator<< (std::ostream &ss, const std::vector< bool > &bytebuff)
 
template<long unsigned int Size>
std::ostream & logicalaccess::operator<< (std::ostream &ss, const std::array< uint8_t, Size > &bytearray)
 
void logicalaccess::trace_print_helper (std::stringstream &ss, const char *param_names, int)
 
std::string logicalaccess::get_nth_param_name (const char *param_names, int idx)
 
template<typename Current , typename... T>
std::enable_if<!std::is_same< unsignedchar, typenamestd::remove_reference< Current >::type >::value >::type logicalaccess::trace_print_helper (std::stringstream &ss, const char *param_names, int idx, Current &&c, T &&... args)
 
template<typename Current , typename... T>
std::enable_if< std::is_same< unsignedchar, typenamestd::remove_reference< Current >::type >::value >::type logicalaccess::trace_print_helper (std::stringstream &ss, const char *param_names, int idx, Current &&c, T &&... args)
 
template<typename... T>
void logicalaccess::trace_print (std::stringstream &ss, const char *param_names, T &&... params)
 

Detailed Description

Logging header.

Author
Maxime C. maxim.nosp@m.e-de.nosp@m.v@isl.nosp@m.og.c.nosp@m.om

Macro Definition Documentation

◆ EXCEPTION

#define EXCEPTION (   type,
  ... 
)     type(/*__FUNCTION__ "," __FILE__ "," __LINE__ " : "*/ __VA_ARGS__)

Convenient alias to create an exception.

◆ EXCEPTION_ASSERT

#define EXCEPTION_ASSERT (   condition,
  type,
  msg 
)
Value:
if (!(condition)) \
{ \
throw EXCEPTION(type, msg); \
}
#define EXCEPTION(type,...)
Convenient alias to create an exception.
Definition: logs.hpp:14

Assertion which raises an exception on failure.

◆ EXCEPTION_ASSERT_WITH_LOG

#define EXCEPTION_ASSERT_WITH_LOG (   condition,
  type,
  msg,
  ... 
)
Value:
if (!(condition)) \
{ \
THROW_EXCEPTION_WITH_LOG(type, msg, ##__VA_ARGS__); \
}

Assertion which raises an exception on failure with logs.

◆ LLA_LOG_CTX

#define LLA_LOG_CTX (   param)
Value:
LogContext lla_log_ctx([&](void) { \
std::stringstream logger_macro_ss__; \
logger_macro_ss__ << param; \
return logger_macro_ss__.str(); \
}())

◆ LOG

#define LOG (   x)    logicalaccess::Logs(__FILE__, __FUNCTION__, __LINE__, x)

◆ THROW_EXCEPTION_WITH_LOG

#define THROW_EXCEPTION_WITH_LOG (   type,
  msg,
  ... 
)
Value:
{ \
throw EXCEPTION(type, msg, ##__VA_ARGS__); \
}
@ ERRORS
Definition: logs.hpp:44

Convenient alias to throw an exception with logs.

◆ TRACE

#define TRACE (   ...)
Value:
std::stringstream trace_stringstream; \
trace_print(trace_stringstream, #__VA_ARGS__, ##__VA_ARGS__); \
LOG(TRACE) << trace_stringstream.str();
#define TRACE(...)
Definition: logs.hpp:217

Log something at the TRACE level. This is a variadic macro that accepts all parameters types and will output something like [param_name -> param_value]