An open API service indexing awesome lists of open source software.

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.

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