mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-18 10:59:45 +00:00
Add examples/esp32/uart-bridge
This commit is contained in:
1 parent
2d5c26d44f
commit
46bf79455c
20 files changed
+434
-8
No files matched your search
+6
-6
@@ -3683,12 +3683,12 @@ Usage example: redirecting logs to syslog.
|
||||
|
||||
```c
|
||||
static void mylog(uint8_t ch) {
|
||||
static char buf[128];
|
||||
static struct mg_iobuf log = { .buf = buf, .size = sizeof(buf), .len = 0};
|
||||
log.buf[log.len++] = ch;
|
||||
if (ch == '\n' || log.len >= log.size) {
|
||||
syslog(LOG_INFO, "%.*s", (int) log.len, log.buf);
|
||||
log.len = 0;
|
||||
static char buf[256];
|
||||
static size_t len;
|
||||
buf[len++] = ch;
|
||||
if (ch == '\n' || len >= sizeof(buf)) {
|
||||
syslog(LOG_INFO, "%.*s", (int) len, buf); // Send logs
|
||||
len = 0;
|
||||
}
|
||||
}
|
||||
...
|
||||
|
||||
Reference in new issue
Block a user