https://github.com/0x0c/esp32_streamlogger
A logger using stream for esp-idf.
https://github.com/0x0c/esp32_streamlogger
esp-idf esp32
Last synced: about 2 months ago
JSON representation
A logger using stream for esp-idf.
- Host: GitHub
- URL: https://github.com/0x0c/esp32_streamlogger
- Owner: 0x0c
- License: mit
- Created: 2018-04-17T06:18:53.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-07-03T18:24:42.000Z (almost 8 years ago)
- Last Synced: 2025-06-02T02:27:22.127Z (about 1 year ago)
- Topics: esp-idf, esp32
- Language: C++
- Homepage:
- Size: 10.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# StreamLogger
A logger using stream for esp-idf.
## Requirements
- esp-idf v2.1.1
## Usage
### Print characters
Like this
```
m2d::ESP32::Logger::I << "Hello";
m2d::ESP32::Logger::I << " world"; // Easy to append characters
m2d::ESP32::Logger::I << m2d::ESP32::Logger::endl; // You have to insert `m2d::ESP32::Logger::endl` to print your console.
```
### Change tag
You can change tag string.
Just call `set_tag(std::string tag)` method.
### Output format
Following formats are available in `include/StreamLogger/Logger.h`:
```
static Stream E; // wrapper of ESP_LOGE
static Stream W; // wrapper of ESP_LOGW
static Stream I; // wrappaer of ESP_LOGI
static Stream D; // wrapper of ESP_LOGD
static Stream V; // wrapper of ESP_LOGV
```
### Add your original formatter
1. Implement subclass of `Impl`.
2. Implement `void print(const char *str)` method.
3. Declare as `Stream logger`.
## License
MIT