Historical is syslog (3). From C:
#include <syslog.h>
openlog("myprogram", LOG_PID, LOG_LOCAL0);
syslog(LOG_INFO, "data %d %s", 3, "example");
From Perl:
use Sys::Syslog;
openlog "myprogram", "pid", "local0";
syslog 'info', 'data %d %s', 3, 'example';
From the shell:
logger -p local0.info -t myprogram -- data 3 example
The syslogd daemon can be configured to place log files in different places (files, tty, other machines) depending on the object (here LOG_LOCAL0) and priority (here LOG_INFO)
source
share