A minimalistic data and event logging library built for both embedded and mainstream C programs
- Basic logging (TRACE, INFO, WARNING, CRITICAL, etc)
- Supports real-world time via NTP
- Support CPU time
- File size check
- Cyclic logging
- Network log data dump
- JSON format support
- Fetch logs between specific periods of time/date etc
- Follows MISRA-C standard
Copy the following files into your working directory:
1. config.h
2. logga.h
3. logga.cpp
The code below shows how to create logging object:
yourfile.cpp
#include <iostream>
#include <stdint.h>
#include "logga.h"
//#define NLOG / to turn on/off logging **/
#ifndef NLOG
#define LOG_FILE_SIZE
Logga_Type_t system_logger = create_logga(); /* create logger object */
const char* filename = "/log-file.log"; /* your logging filename */
#endif
int main() {
#ifndef NLOG
init_logga(system_logger, filename);
#endif
return 0;
}
The library should work automatically with spiffs when using an ESP32 If the ESP32 SPIFFS is not recognized, please use the following resource to fix the issue: !(Set up spiffs on ESP32)[https://www.programmingelectronics.com/spiffs-esp32/]