1

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?

| improve this question | | | | |
5

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.

enter image description here

| improve this answer | | | | |
  • perfect answer, very clear ! Thanks @juraj – Cerber May 10 '18 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.