Since it is hard to debug when it not connected via serial, I was thinking it would almost as good if I could just open a UDP listener on my machine using netcat, and just replace all the Serial.println() to just send the data out to my machine. I thought it seemed like a good idea, and figured someone must have already done this, and was wondering if anyone had any code to share?
I haven’t done it yet, but I’m planning to implement a syslog library that will basically work somewhat similar to printf (will use sprintf under the hood).
void openlog(const char *ident, int option, int facility);
void syslog(priority, char *fmt, …);
openly would initialize the syslog functionality.
ident is a string prepended to every message identifying the source of the particular message. (Free form text)
option is an or of any of LOG_CONS, LOG_NDELAY, LOG_NOWAIT, LOG_ODELAY, LOG_PERROR, LOG_PID
See any posix man(3) syslog page for details.
facility is one of (LOG_AUTH, LOG_AUTHPRIV, LOG_CRON, LOG_DAEMON, LOG_FTP, LOG_KERN, LOG_LOCAL0-7,
LOG_LPR, LOG_MAIL, LOG_NEWS, LOG_SYSLOG, LOG_USER (default) or LOG_UUCP)
priority is one of (in decreasing order) LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG
Anyone with a linux system or such can easily set up a syslog server, so if you have netcat, you probably have syslog. (Macs have Syslog, too). I think the only people that are SOL are those poor souls running software from Redmond, WA.
However, if you can netcat UDP, you won’t have too much trouble doing that on the syslog port and getting the syslog messages. They’ll be nearly readable anyway.
I’ll try to remember to post back here when I have it up on the libraries.
The firmware has debug logging already implemented and it’s possible to define your own handler for the debug message to route it to UDP.
I want to like this 20 times, but can only do it once. Count me in as an alpha/beta tester.
Taken under advisement.
A bit late to the party here, but I just found this library for remote syslog. I haven’t tried it yet, but in conjunction with something like Papertrail, it should be possible to get remote logging up and running very easily. Of course, you could set up your own log endpoint too, but I’ve found Papertrail to be braindead easy and it’s one less thing to worry about.
@owendelong, just an FYI…I realize the date on this is more than a little old.
Windows users can download a free copy of Kiwi Syslog Manager. It works great.
For the record, I just uploaded a very simple syslog client…search for “syslog” and my entry comes up first.
I use it to syslog simple messages from various programs.