4#include "include/types.hpp"
5#include "include/util.hpp"
6#include "include/clock.hpp"
7#include "include/task.hpp"
8#include "include/fsm.hpp"
9#include "include/timer.hpp"
10#include "include/input.hpp"
11#include "config/config.h"
70 struct source_location {
72 #if not defined(__apple_build_version__) and defined(__clang__) and (__clang_major__ >= 9)
73 static constexpr source_location current(
const char* fileName = __builtin_FILE(),
74 const char* functionName = __builtin_FUNCTION(),
75 const unsigned long lineNumber = __builtin_LINE(),
76 const unsigned long columnOffset = __builtin_COLUMN() )
noexcept
77 #elif defined(__GNUC__) and (__GNUC__ > 4 or (__GNUC__ == 4 and __GNUC_MINOR__ >= 8))
78 static constexpr source_location current(
const char* fileName = __builtin_FILE(),
79 const char* functionName = __builtin_FUNCTION(),
80 const unsigned long lineNumber = __builtin_LINE(),
81 const unsigned long columnOffset = 0 )
noexcept
83 static constexpr source_location current(
const char* fileName =
"unsupported",
84 const char* functionName =
"unsupported",
85 const unsigned long lineNumber = __LINE__,
86 const unsigned long columnOffset = 0)
noexcept
89 return source_location( fileName, functionName, lineNumber, columnOffset );
92 source_location(
const source_location & ) =
default;
93 source_location( source_location && ) =
default;
95 constexpr const char* file_name(
void )
const noexcept
100 constexpr const char* function_name(
void )
const noexcept
105 constexpr unsigned long line(
void )
const noexcept
110 constexpr unsigned long column(
void )
const noexcept
116 constexpr source_location(
const char* FileName,
const char* FunctionName,
const unsigned long LineNumber,
const unsigned long ColumnOffset ) noexcept
117 : fileName(FileName), functionName(FunctionName), lineNumber(LineNumber), columnOffset(ColumnOffset) {}
119 const char* fileName;
120 const char* functionName;
121 const unsigned long lineNumber;
122 const unsigned long columnOffset;
125 class lout_base final {
128 explicit lout_base(uint8_t b) : base(b) {}
160 explicit mem(
size_t nb ) : n( nb ) {}
181 explicit pre( uint8_t p ) : precision( p ) {}
193 extern const lout_base
dec;
203 extern const lout_base
hex;
213 extern const lout_base
oct;
223 extern const lout_base
bin;
231 extern const char *
const endl;
240 extern const char *
const end;
248 extern const char *
const nrm;
256 extern const char *
const red;
264 extern const char *
const grn;
272 extern const char *
const yel;
280 extern const char *
const blu;
288 extern const char *
const mag;
296 extern const char *
const cyn;
304 extern const char *
const wht;
307 class _logger final {
310 _logger( _logger &other ) =
delete;
311 void operator=(
const _logger & ) =
delete;
312 const char *s_str[ 7 ] = {
"",
"[fatal]: ",
"[error]: ",
"[warning]: ",
"[info]: ",
"[debug] ",
"" };
313 uint8_t base = { 10U };
315 uint8_t precision { 6U };
316 #if ( Q_TRACE_BUFSIZE < 36 )
317 #define Q_TRACE_BUFSIZE ( 36 )
320 char preFix[ 5 ] = { 0 };
322 void writeNumStr(
void )
noexcept;
324 static _logger& getInstance(
void )
noexcept;
325 template <
typename T>
326 inline _logger& _log_integer(
const T& v,
bool is_int )
330 (void)util::integerToString(
static_cast<signed_t>( v ), buffer, base );
333 (void)util::unsignedToString(
static_cast<unsigned_t>( v ), buffer, base );
339 _logger& operator<<(
const char& v );
340 _logger& operator<<(
const char * s );
341 _logger& operator<<(
const short& v );
342 _logger& operator<<(
const int& v );
343 _logger& operator<<(
const long int& v );
344 _logger& operator<<(
const unsigned char& v );
345 _logger& operator<<(
const unsigned short& v );
346 _logger& operator<<(
const unsigned int& v );
347 _logger& operator<<(
const unsigned long& v );
348 _logger& operator<<(
const void *
const p );
349 _logger& operator<<(
const float64_t& v );
350 _logger& operator<<(
const lout_base& f );
351 _logger& operator<<(
const mem& m );
352 _logger& operator<<(
const pre& m );
353 _logger& operator<<(
const task& t );
359 _logger& operator<<(
const qOS::string & s );
361 friend _logger& out(
const logSeverity s,
const source_location &loc )
noexcept;
364 extern _logger& _logger_out;
374 _logger& out(
const logSeverity s = logSeverity::none,
const source_location &loc = source_location::current() ) noexcept;
376 inline const
char * var( const
char * vname ){
return vname; }
385#define var(v) var( #v ) << '=' << (v)
Class that sets the number of bytes to be logged when a pointer is being used after....
Definition logger.hpp:151
mem(size_t nb)
Instantiates a memory specifier to logger nb bytes.
Definition logger.hpp:160
Class that sets the decimal precision to be used to format floating-point values on logger operations...
Definition logger.hpp:172
pre(uint8_t p)
Instantiates a precision specifier of p decimal points.
Definition logger.hpp:181
The global class to output logging streams. Its usage requires the static method: logger::out()
Definition logger.hpp:25
static logger & out(const logSeverity s)
Specify a new logger output with severity level of information (if defined).
static logger & var(const void &v)
Specify that the variable given by v should be printed with its own name : <var::name> = <var::value>
A state object.
Definition fsm.hpp:542
A FSM(Finite State Machine) object.
Definition fsm.hpp:822
A task node object.
Definition task.hpp:348
A non-blocking Timer object.
Definition timer.hpp:26
#define Q_TRACE_BUFSIZE
Size for the trace internal buffer.
Definition config.h:95
void(*)(void *, const char) putChar_t
Pointer to function that write-out a single character.
Definition util.hpp:33
const char *const red
Set colored output to "red" after the usage of this statement Example:
Definition logger.hpp:256
const char *const cyn
Set colored output to "cyan" after the usage of this statement Example:
Definition logger.hpp:296
const char *const yel
Set colored output to "yellow" after the usage of this statement Example:
Definition logger.hpp:272
const char *const blu
Set colored output to "blue" after the usage of this statement Example:
Definition logger.hpp:280
const char *const wht
Set colored output to "white" after the usage of this statement Example:
Definition logger.hpp:304
logSeverity
Definition logger.hpp:132
const lout_base bin
Modifies the default numeric base to binary for integer logger output Example:
Definition logger.hpp:223
const char *const grn
Set colored output to "green" after the usage of this statement Example:
Definition logger.hpp:264
const lout_base oct
Modifies the default numeric base to octal for integer logger output Example:
Definition logger.hpp:213
const char *const mag
Set colored output to "magenta" after the usage of this statement Example:
Definition logger.hpp:288
const lout_base hex
Modifies the default numeric base to hexadecimal for integer logger output Example:
Definition logger.hpp:203
const lout_base dec
Modifies the default numeric base to decimal for integer logger output Example:
Definition logger.hpp:193
void setOutputFcn(util::putChar_t fcn)
Set the output method for the logger stream.
const char *const nrm
Set colored output to "normal" after the usage of this statement Example:
Definition logger.hpp:248
const char *const end
Inserts a new-line character to the logger output and restore the default color Example:
Definition logger.hpp:240
const char *const endl
Inserts a new-line character to the logger output. Example:
Definition logger.hpp:231
@ none
Definition logger.hpp:133
@ info
Definition logger.hpp:137
@ warning
Definition logger.hpp:136
@ error
Definition logger.hpp:135
@ verbose
Definition logger.hpp:139
@ fatal
Definition logger.hpp:134
@ debug
Definition logger.hpp:138
trigger
An enum with all the possible values for the event_t::getTrigger() method.
Definition task.hpp:23
unsigned long unsigned_t
A type to instantiate an unsigned variable.
Definition types.hpp:72
long int signed_t
A type to instantiate an signed variable.
Definition types.hpp:77
double float64_t
A type to instantiate a single-precision variable of 64-bits IEEE 754.
Definition types.hpp:87
OS/Kernel interfaces.
Definition bytebuffer.hpp:7