Add initial crypto functionality
[libcontrac.git] / src / log.c
1 /** \ingroup contrac
2 * @file
3 * @author David Llewellyn-Jones
4 * @version $(VERSION)
5 *
6 * @section LICENSE
7 *
8 *
9 *
10 * @brief
11 * @section DESCRIPTION
12 *
13 *
14 *
15 */
16
17 // Includes
18
19 #include <time.h>
20 #include <stdio.h>
21 #include <stdarg.h>
22 #include <malloc.h>
23
24 #include "contrac/log.h"
25
26 // Defines
27
28 // Structures
29
30 // Function prototypes
31
32 void log_priority(int priority, const char *format, ...) {
33 va_list args;
34 int length;
35 char *buffer;
36
37 va_start(args, format);
38 length = vsnprintf(NULL, 0, format, args);
39 va_end(args);
40
41 buffer = malloc(sizeof(char) * (length + 1));
42
43 va_start(args, format);
44 length = vsnprintf(buffer, length + 1, format, args);
45 va_end(args);
46 buffer[length] = 0;
47
48 syslog(priority, "%s", buffer);
49 }
50
51 // Function definitions
52