rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
loggingcentral.h
Go to the documentation of this file.
1/**
2 * @file loggingcentral.h
3 *
4 * @date Mar 8, 2015
5 * @author Andrey Belomutskiy, (c) 2012-2020
6 */
7#pragma once
8
9#include <cstddef>
11
12class Logging;
13
15
16const char* swapOutputBuffers(size_t *actualOutputBufferSize);
17
18namespace priv
19{
20 // internal implementation, use efiPrintf below
21 void efiPrintfInternal(const char *fmt, ...)
22 #if EFI_PROD_CODE
23 __attribute__ ((format (printf, 1, 2)))
24 #endif
25 ;
26}
27
28// "normal" logging messages need a header and footer, so put them in
29// the format string at compile time
30#define efiPrintfProto(proto, fmt, ...) priv::efiPrintfInternal(proto LOG_DELIMITER fmt LOG_DELIMITER, ##__VA_ARGS__)
31#define efiPrintf(fmt, ...) efiPrintfProto(PROTOCOL_MSG, fmt, ##__VA_ARGS__)
32
33/**
34 * This is the legacy function to copy the contents of a local Logging object in to the output buffer
35 */
36void scheduleLogging(Logging *logging);
37
38// Stores the result of one call to efiPrintfInternal in the queue to be copied out to the output buffer
40 char buffer[256];
41};
42
43template <size_t TBufferSize>
44class LogBuffer {
45public:
46 void writeLine(LogLineBuffer* line);
47 void writeLogger(Logging* logging);
48
49 size_t length() const;
50 void reset();
51 const char* get() const;
52
53#if !EFI_UNIT_TEST
54private:
55#endif
56 void writeInternal(const char* buffer);
57
58 char m_buffer[TBufferSize];
60};
typedef __attribute__
Ignition Mode.
void writeLine(LogLineBuffer *line)
void writeLogger(Logging *logging)
void writeInternal(const char *buffer)
char m_buffer[TBufferSize]
char * m_writePtr
size_t length() const
const char * get() const
void scheduleLogging(Logging *logging)
const char * swapOutputBuffers(size_t *actualOutputBufferSize)
void startLoggingProcessor()
void efiPrintfInternal(const char *format,...)
char buffer[256]
static BigBufferHandle buffer
printf("\n")