Skip to content
/ lerr Public

err(3) style logging API with console and syslog backends

License

Notifications You must be signed in to change notification settings

dgwynne/lerr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lerr() - err(3) style logging API with console and syslog backends

This API supports logging by daemons, either to syslog or to the console. It is modelled after the API provided by the err(3) family of functions.

By default logging is output to the console via the err(3) API. However, if the daemon forks, the same API can be directed to syslog.

API

lerr(), lerrx(), lwarn(), and lwarnx() are equivalent to err(), errx(), warn(), and warnx() respectively.

linfo() and ldebug() can be used to log information at the LOG_INFO and LOG_DEBUG log levels in the syslog() backend. warnx() is used as the backend for these functions in console logger.

logger_syslog() is used to switch the logger from console output to syslog output. Internally it passes the progname argument as the ident argument to openlog(3).

Examples

if (!debug) {
	logger_syslog(getprogname());
}
linfo("program has started");

About

err(3) style logging API with console and syslog backends

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published