I'd like to "merge" two Arduino libraires, namely log4Esp on one side and Syslog on the other, hence creating a syslog appender for log4esp.
My problem is that log4esp's Appender prototype expects a method to return an instance of Print
to which it'll write the message.
Syslog can't be used in this way.
==> Question : How to create a "Print buffer" / where can I find which class extends Print
?
-
Cerber, question for you arduino.stackexchange.com/questions/58502/…Juraj– Juraj ♦2018年12月05日 10:16:03 +00:00Commented Dec 5, 2018 at 10:16
1 Answer 1
Class Print
is a base class of Arduino streaming. Stream
is a derived class and adds reading capability. Print
has only one abstract method write
to write one byte to output or buffer. It is easy to implement a derived custom class.
The classes derived from Stream are classes for hardware and software serial like HardwareSerial for Serial singletons and different software serial implementations. From Stream is derived class File of the SD and SPIFFS library, TwoWire class for Wire singleton object, etc.
Class Client is derived from class Stream and is a base class for Arduino standard TCP networking. Examples of derived classes are EthernetClient, WiFiClient. For UDP, class UDP is derived from Stream, of course with implementations like EthernetUDP, WiFiUDP.
You can see this in the source code in local source file folders or in GitHub repositories.
-
perfect answer, very clear ! Thanks @jurajCerber– Cerber2018年05月10日 14:27:28 +00:00Commented May 10, 2018 at 14:27