Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea/request: Syslog compatibility #24

Closed
freol35241 opened this issue Oct 30, 2024 · 7 comments
Closed

Idea/request: Syslog compatibility #24

freol35241 opened this issue Oct 30, 2024 · 7 comments

Comments

@freol35241
Copy link

First, thanks for this awesome library!

In a similar manner as the file logging functionality, it would be really useful to have an optional syslog "logger" which sends all log messages in Syslog format over UDP.

@hideakitai
Copy link
Owner

Thanks for the suggestion. The syslog format, especially the log format that requires timestamps, is not the same on all platforms, so it would be difficult for the library to support it on all platforms.

Having them create it themselves in a custom format would be better.

@freol35241
Copy link
Author

freol35241 commented Nov 7, 2024

Thanks for getting back on this topic. I was under the impression that the syslog format was standardized according to https://datatracker.ietf.org/doc/html/rfc5424 but I might very well be naive here.

Regardless, would you care to elaborate on your last sentence with regards to a custom format. Do you mean there is already a preferred way of extending DebugLog with another custom logging format/transport?

@hideakitai
Copy link
Owner

@freol35241
Copy link
Author

Ah, yes, thanks. That makes perfect sense for the formatting part. But I am still unsure about how to use a custom transport (or sink if you will) for all log messages. Right now, I believe there are two implementations, to a serial port and to a file. How would I go about pushing the log messages over UDP instead/also?

@hideakitai
Copy link
Owner

You can attach any Stream* class to output. But I should rename/add LOG_ATTCH_STREAM().

    LOG_ATTACH_SERIAL(&Serial2);
    LOG_ATTACH_SERIAL(&your_udp_client);
    LOG_ATTACH_SERIAL(&your_tcp_client);

@hideakitai
Copy link
Owner

hideakitai commented Nov 9, 2024

v0.8.4 adds

LOG_ATTACH_STREAM(your_udp_client);

@freol35241
Copy link
Author

Oh, that makes sense now that I see your examples, awesome! And, yes, the additional "overload" introduced in 0.8.4 makes it a lot clearer 👍

Feel free to close this issue and thanks for your quick and helpful response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants