.TH "dlog.h" 3 "Mon Dec 21 2020" "Version 0.14" "libdaemon" \" -*- nroff -*- .ad l .nh .SH NAME dlog.h \- Contains a robust API for logging messages\&. .SH SYNOPSIS .br .PP \fC#include \fP .br \fC#include \fP .br .SS "Macros" .in +1c .ti -1c .RI "#define \fBDAEMON_GCC_PRINTF_ATTR\fP(a, b)" .br .RI "A macro for making use of GCCs printf compilation warnings\&. " .ti -1c .RI "#define \fBDAEMON_LOGV_AVAILABLE\fP 1" .br .RI "This variable is defined to 1 iff \fBdaemon_logv()\fP is supported\&. " .ti -1c .RI "#define \fBDAEMON_SET_VERBOSITY_AVAILABLE\fP 1" .br .RI "This variable is defined to 1 iff \fBdaemon_set_verbosity()\fP is available\&. " .in -1c .SS "Enumerations" .in +1c .ti -1c .RI "enum \fBdaemon_log_flags\fP { \fBDAEMON_LOG_SYSLOG\fP = 1, \fBDAEMON_LOG_STDERR\fP = 2, \fBDAEMON_LOG_STDOUT\fP = 4, \fBDAEMON_LOG_AUTO\fP = 8 }" .br .RI "Specifies where to send the log messages to\&. " .in -1c .SS "Functions" .in +1c .ti -1c .RI "void \fBdaemon_log\fP (int prio, const char *t,\&.\&.\&.) \fBDAEMON_GCC_PRINTF_ATTR\fP(2" .br .RI "Log a message using printf format strings using the specified syslog priority\&. " .ti -1c .RI "void \fBdaemon_logv\fP (int prio, const char *t, va_list ap)" .br .RI "Same as \fBdaemon_log()\fP, but without variadic arguments\&. " .ti -1c .RI "char * \fBdaemon_ident_from_argv0\fP (char *argv0)" .br .RI "Return a sensible syslog identification for daemon_log_ident generated from argv[0]\&. " .ti -1c .RI "void \fBdaemon_set_verbosity\fP (int verbosity_prio)" .br .RI "Setter for the verbosity level of standard output\&. " .in -1c .SS "Variables" .in +1c .ti -1c .RI "enum \fBdaemon_log_flags\fP \fBdaemon_log_use\fP" .br .RI "This variable is used to specify the log target(s) to use\&. " .ti -1c .RI "const char * \fBdaemon_log_ident\fP" .br .RI "Specifies the syslog identification, use \fBdaemon_ident_from_argv0()\fP to set this to a sensible value or generate your own\&. " .in -1c .SH "Detailed Description" .PP Contains a robust API for logging messages\&. .PP Definition in file \fBdlog\&.h\fP\&. .SH "Macro Definition Documentation" .PP .SS "#define DAEMON_GCC_PRINTF_ATTR(a, b)" .PP A macro for making use of GCCs printf compilation warnings\&. .PP Definition at line 59 of file dlog\&.h\&. .SS "#define DAEMON_LOGV_AVAILABLE 1" .PP This variable is defined to 1 iff \fBdaemon_logv()\fP is supported\&. .PP \fBSince\fP .RS 4 0\&.11 .RE .PP \fBSee also\fP .RS 4 \fBdaemon_logv()\fP .RE .PP .PP Definition at line 72 of file dlog\&.h\&. .SS "#define DAEMON_SET_VERBOSITY_AVAILABLE 1" .PP This variable is defined to 1 iff \fBdaemon_set_verbosity()\fP is available\&. .PP \fBSince\fP .RS 4 0\&.14 .RE .PP \fBSee also\fP .RS 4 \fBdaemon_set_verbosity()\fP .RE .PP .PP Definition at line 92 of file dlog\&.h\&. .SH "Enumeration Type Documentation" .PP .SS "enum \fBdaemon_log_flags\fP" .PP Specifies where to send the log messages to\&. The global variable daemon_log_use takes values of this type\&. .PP \fBEnumerator\fP .in +1c .TP \fB\fIDAEMON_LOG_SYSLOG \fP\fP Log messages are written to syslog\&. .TP \fB\fIDAEMON_LOG_STDERR \fP\fP Log messages are written to STDERR\&. .TP \fB\fIDAEMON_LOG_STDOUT \fP\fP Log messages are written to STDOUT\&. .TP \fB\fIDAEMON_LOG_AUTO \fP\fP If this is set a \fBdaemon_fork()\fP will change this to DAEMON_LOG_SYSLOG in the daemon process\&. .PP Definition at line 38 of file dlog\&.h\&. .SH "Function Documentation" .PP .SS "char* daemon_ident_from_argv0 (char * argv0)" .PP Return a sensible syslog identification for daemon_log_ident generated from argv[0]\&. This will return a pointer to the file name of argv[0], i\&.e\&. strrchr(argv[0], '\\')+1 .PP \fBParameters\fP .RS 4 \fIargv0\fP argv[0] as passed to main() .RE .PP \fBReturns\fP .RS 4 The identification string .RE .PP .PP \fBExamples\fP .in +1c \fBtestd\&.c\fP\&. .SS "void daemon_log (int prio, const char * t, \&.\&.\&.)" .PP Log a message using printf format strings using the specified syslog priority\&. .PP \fBParameters\fP .RS 4 \fIprio\fP The syslog priority (PRIO_xxx constants) .br \fIt,\&.\&.\&.\fP The text message to log .RE .PP .PP \fBExamples\fP .in +1c \fBtestd\&.c\fP\&. .SS "void daemon_logv (int prio, const char * t, va_list ap)" .PP Same as \fBdaemon_log()\fP, but without variadic arguments\&. .PP \fBSince\fP .RS 4 0\&.11 .RE .PP \fBSee also\fP .RS 4 \fBDAEMON_LOGV_AVAILABLE\fP .RE .PP .SS "void daemon_set_verbosity (int verbosity_prio)" .PP Setter for the verbosity level of standard output\&. .PP \fBParameters\fP .RS 4 \fIverbosity_prio\fP Minimum priority level for messages to output on standard output/error .RE .PP Allows to decide which messages to output on standard output/error streams\&. All messages are logged to syslog and this setting does not influence that\&. .PP The default value is LOG_WARNING\&. .PP \fBSince\fP .RS 4 0\&.14 .RE .PP \fBSee also\fP .RS 4 \fBDAEMON_SET_VERBOSITY_AVAILABLE\fP .RE .PP .SH "Variable Documentation" .PP .SS "const char* daemon_log_ident\fC [extern]\fP" .PP Specifies the syslog identification, use \fBdaemon_ident_from_argv0()\fP to set this to a sensible value or generate your own\&. .PP \fBExamples\fP .in +1c \fBtestd\&.c\fP\&. .SS "enum \fBdaemon_log_flags\fP daemon_log_use\fC [extern]\fP" .PP This variable is used to specify the log target(s) to use\&. Defaults to DAEMON_LOG_STDERR|DAEMON_LOG_AUTO .SH "Author" .PP Generated automatically by Doxygen for libdaemon from the source code\&.