Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Sunday, December 22, 2013

Syslog

Since I am now starting the synth at boot time, all my logs are going to stdout and it is hard to figure out what is happening when things go wrong. Also printf seem to affect synth performance. For both those reasons, I decided to use syslog for my run time logs. This is what I did:

1. Initialized logs doing:

setlogmask (LOG_UPTO (LOG_DEBUG));
openlog ("mysynth", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_USER);

2. Replaced printfs with one of the following macro calls:

#define ERROR_LOG(...) \
    syslog(LOG_ERR, __VA_ARGS__)

#define INFO_LOG(...) \
    syslog(LOG_INFO, __VA_ARGS__)

#define WARNING_LOG(...) \
    syslog(LOG_WARNING, __VA_ARGS__)

Sunday, December 8, 2013

Start Synth at boot time

In order to have my synth application start when booting the raspberry pi, I followed the instructions here and created an script in /etc/init.d and calling "sudo update-rc.d NameOfYourScript defaults" to register the script.