SAE Teensy ECU
IIT SAE Microcontroller programming
Loading...
Searching...
No Matches
Log.h
Go to the documentation of this file.
1
14#ifndef __ECU_LOGGING_H__
15#define __ECU_LOGGING_H__
16
20#define _LogPrebuildString(x) x
21
22#include <stdint.h>
23#include <stdlib.h>
24
25#include "LogConfig.def"
26
27#if CONF_LOGGING_ASCII_DEBUG
28#include "core_pins.h"
29#include "usb_serial.h"
30#endif
31
32// IMPROVE: Add option to log to an sd card instead/as well
33
34#if CONF_LOGGING_MAPPED_MODE > 0
35typedef const uint16_t LOG_TAG;
36typedef const uint32_t LOG_MSG;
37
38#else
48typedef const char *LOG_TAG;
52typedef const char *LOG_MSG;
53
54#endif
55
63uint32_t TAG2NUM(LOG_TAG tagValue);
64
69namespace Logging {
70
157struct Log_t {
164 void operator()(LOG_TAG TAG, LOG_MSG message);
171 void d(LOG_TAG TAG, LOG_MSG message);
178 void i(LOG_TAG TAG, LOG_MSG message);
185 void w(LOG_TAG TAG, LOG_MSG message);
192 void e(LOG_TAG TAG, LOG_MSG message);
199 void f(LOG_TAG TAG, LOG_MSG message);
208 void operator()(LOG_TAG TAG, LOG_MSG message, const uint32_t number, int mediate = false);
217 void d(LOG_TAG TAG, LOG_MSG message, const uint32_t number, int mediate = false);
226 void i(LOG_TAG TAG, LOG_MSG message, const uint32_t number, int mediate = false);
235 void w(LOG_TAG TAG, LOG_MSG message, const uint32_t number, int mediate = false);
244 void e(LOG_TAG TAG, LOG_MSG message, const uint32_t number, int mediate = false);
253 void f(LOG_TAG TAG, LOG_MSG message, const uint32_t number, int mediate = false);
262 void p(LOG_TAG name, LOG_MSG prettyName, const uint32_t number, int mediate = false);
263};
264
270
277
278} // namespace Logging
279
285extern Logging::Log_t Log;
286
287#endif // __ECU_LOGGING_H__
uint32_t TAG2NUM(LOG_TAG tagValue)
Return the final numbervalue of a LOG_TAG.
const char * LOG_MSG
Type definition for logging messages, only used internally.
Definition Log.h:52
const char * LOG_TAG
Type definition of logging tags This typedef is necessary to allow for easier manipulation of code by...
Definition Log.h:48
Logging::Log_t Log
The global logging object.
Configuration file for the Log Module.
Namespace to isolate Log_t struct.
Definition Log.h:69
void enableCanbusRelay()
If a set address is received through canbus, the data will be pushed to a buffer to be printed.
void printLookup()
Print the ZLib compressed string of the current lookup table to serial.
Base class used to log things over serial.
Definition Log.h:157
void operator()(LOG_TAG TAG, LOG_MSG message)
Log a string usb serial.
void operator()(LOG_TAG TAG, LOG_MSG message, const uint32_t number, int mediate=false)
Log a string and a variable number to usb serial.
void d(LOG_TAG TAG, LOG_MSG message, const uint32_t number, int mediate=false)
Log a string and a variable number using a debug tag.
void d(LOG_TAG TAG, LOG_MSG message)
Log a string using a debug tag.
void w(LOG_TAG TAG, LOG_MSG message)
Log a string using a warning tag.
void e(LOG_TAG TAG, LOG_MSG message)
Log a string using an error tag.
void i(LOG_TAG TAG, LOG_MSG message, const uint32_t number, int mediate=false)
Log a string and a variable number using an info tag.
void f(LOG_TAG TAG, LOG_MSG message, const uint32_t number, int mediate=false)
Log a string and a variable number using a fatal tag.
void i(LOG_TAG TAG, LOG_MSG message)
Log a string using an info tag.
void e(LOG_TAG TAG, LOG_MSG message, const uint32_t number, int mediate=false)
Log a string and a variable number using an error tag.
void w(LOG_TAG TAG, LOG_MSG message, const uint32_t number, int mediate=false)
Log a string and a variable number using a warning tag.
void p(LOG_TAG name, LOG_MSG prettyName, const uint32_t number, int mediate=false)
Post a monitored value.
void f(LOG_TAG TAG, LOG_MSG message)
Log a string using a fatal tag.