acnlog.h

Macros for logging and debug

These macros loosely follow syslog syntax but the loglevel is tested at compile time and outputs compile to nothing if the loglevel is not high enough.

The calls can be configured to send output to syslog, stdout, stderr or nothing.

See Logging for more detail.

Summary
acnlog.hThese macros loosely follow syslog syntax but the loglevel is tested at compile time and outputs compile to nothing if the loglevel is not high enough.
Macros
LoglevelsIf using syslog, use the system’s own definitions.
Log output functionsAll log functions are defined as macros which depend on CF_ACNLOG
short version facility and level macros

Macros

Loglevels

If using syslog, use the system’s own definitions.  Otherwise they are defined here as copied directly from FreeBSD

LOG_EMERGsystem is unusable
LOG_ALERTaction must be taken immediately
LOG_CRITcritical conditions
LOG_ERRerror conditions
LOG_WARNINGwarning conditions
LOG_NOTICEnormal but significant condition
LOG_INFOinformational
LOG_DEBUGdebug-level messages

Log output functions

All log functions are defined as macros which depend on CF_ACNLOG

acnopenlog(), acncloselog()call at start and end of program
acntestlog()use to test whether a particular loglevel would generate code which is useful where logging requires aditional code or variable definitions.
acnlog()generate an arbitrary message (depending on priority)
acnlogmark()generate a “function, file, line” message before the log message
acnlogerror()roughly equivalent to perror() library function
LOG_FSTART()mark the entry to a function
LOG_FEND()mark the exit from a fnction

short version facility and level macros

lgEMRG(lgFCTY | LOG_EMERG)
lgALRT(lgFCTY | LOG_ALERT)
lgCRIT(lgFCTY | LOG_CRIT)
lgERR(lgFCTY | LOG_ERR)
lgWARN(lgFCTY | LOG_WARNING)
lgNTCE(lgFCTY | LOG_NOTICE)
lgINFO(lgFCTY | LOG_INFO)
lgDBUG(lgFCTY | LOG_DEBUG)

lgFCTY must be defined (usually at top of source file) before using these. e.g. from sdt.c

#define lgFCTY LOG_SDT
Logging options
Close