1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-08-26 07:44:33 +02:00

Added comments on how streams work

This commit is contained in:
Stefan de Bruijn
2021-05-18 23:03:00 +02:00
parent 94c2140faf
commit a7e2e70ed1

View File

@@ -0,0 +1,39 @@
# Simple output stream
The simple output stream is a very basic implementation of
`std::ostream`, but without all the plumbing and overhead
of the std implementation, and without `dynamic_cast`.
The simple output stream is implemented to be able to stream
data, instead of allocating fixed buffers. For the YAML
configuration system, this is mostly useful for streaming
data to flash.
The syntax is the same as for std::ostream:
` myStream << "foo" << myInt << etc.;`
**NOTE:** Do NOT use `std::endl` or include `iostream`. Use basic
types and strings like `"\n"` instead if needed.
## Debug stream
`Logging` implements a debug stream, which is basically a way to
do (development) logging without creating fixed-size buffers.
Currently, the default implementation simply throws the log to
`Serial`, which should be probably improved at some point to
use clients.
Usage:
```c++
log_info("Twelve is written as " << 12 << ", isn't it");
```
Available are the following macro's that default to 'void':
- log_debug
- log_info
- log_warn
- log_error
- log_fatal