[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section is under development
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The rules used by `syslog' are normally defined in `/etc/syslog.conf'. Each line specifies the destination for messages with particular sources and priorities. For example:
# log mail messages at priority info to mailinfo mail.info /var/log/mailinfo # log all ftp information to syslog on a remote machine ftp.* @remote-machine.cs.ntu.edu.au # all critical errors to console *.crit /dev/console |
To use `syslog' we merely redefine the default handlers and parameter values for `nana'. For example:
#include <syslog.h> #define L_DEFAULT_HANDLER syslog /* replaces fprintf(3) by syslog(3) */ #define L_DEFAULT_PARAMS LOG_USER /* default priority for syslog info */ #include <nana.h> int main() { openlog("nana", /* identifier for these log messages */ LOG_PID, /* also log the process id */ LOG_DAEMON /* facility */ ); L("temperature is falling to %d", 35); /* logged at LOG_USER priority */ LP(LOG_CRIT, "the snow is falling in Darwin"); /* LOG_CRIT message */ closelog(); return 0; } |
This program results in the following addition to `/var/adm/messages':
Jun 12 16:04:46 chingiz nana[2671]: the temperature is falling to 35 Jun 12 16:04:46 chingiz nana[2671]: the snow is falling in Darwin |
In addition the `LOG_CRIT' message about snow falling in Darwin is sent to the console for immediate action.
Note: `syslog' normally uses `UDP' for its network communications and that `UDP' does not guarantee delivery.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To achieve this noble goal you can provide your configure script with a `--without-nana'(20) flag which then `#define's' `WITHOUT_NANA'. You should also use the `VL' macro rather than `L' macro since `L' takes a variable number of arguments and will break non GNU C preprocessors.
int half(int n) { /* Don't use L(...) since it takes a variable number of args! */ VL(("hello world = %d\n", 10)); /* Note the doubled (( */ ...; } |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Instead you can use a series of programs which execute over a the results of the program and check that the behaviour meets the specification automatically.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
For a small example of this, see `tcl/status.c'.
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |