Add remaining documentation
[libcontrac.git] / include / contrac / log.h
1 /** \ingroup Logging
2 * @file
3 * @author David Llewellyn-Jones <david@flypig.co.uk>
4 * @version $(VERSION)
5 *
6 * @section LICENSE
7 *
8 * Copyright David Llewellyn-Jones, 2020
9 * Released under the GPLv2.
10 *
11 * @brief Allows output to be sent to the log
12 * @section DESCRIPTION
13 *
14 * This is a simple set of functions and macros that allows strings to be
15 * recorded in the syslog.
16 *
17 */
18
19 /** \addtogroup Logging
20 * @{
21 */
22
23 #ifndef __LOG_H
24 #define __LOG_H
25
26 // Includes
27
28 #include <syslog.h>
29
30 // Defines
31
32 /**
33 * Log a string to syslog.
34 *
35 * Constructs a message using the supplied format and parameters and records it
36 * in the system log. The format is the same as for printf.
37 *
38 * The logging levels are the standard syslog levels:
39 *
40 * LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERR, etc.
41 *
42 * @param priority The log level priority.
43 * @param format The format for the message, the same as for printf.
44 * @param ... parameters to combine with the format to create the message.
45 */
46 #define LOG(level, ...) log_priority(level, __VA_ARGS__);
47
48 // Structures
49
50 // Function prototypes
51
52 void log_priority(int priority, const char *format, ...);
53
54 // Function definitions
55
56 #endif // __LOG_H
57
58 /** @} addtogroup Logging*/