X-Git-Url: https://www.flypig.org.uk/git/?p=libcontrac.git;a=blobdiff_plain;f=src%2Flog.c;fp=src%2Flog.c;h=599b945fd90f3a1bddd019884db4888006c00393;hp=0000000000000000000000000000000000000000;hb=8515bbba069347de07a452586d7e49a2e8bdf151;hpb=79942abab927241b65a29a8a30d71b8efe6b6d94 diff --git a/src/log.c b/src/log.c new file mode 100644 index 0000000..599b945 --- /dev/null +++ b/src/log.c @@ -0,0 +1,52 @@ +/** \ingroup contrac + * @file + * @author David Llewellyn-Jones + * @version $(VERSION) + * + * @section LICENSE + * + * + * + * @brief + * @section DESCRIPTION + * + * + * + */ + +// Includes + +#include +#include +#include +#include + +#include "contrac/log.h" + +// Defines + +// Structures + +// Function prototypes + +void log_priority(int priority, const char *format, ...) { + va_list args; + int length; + char *buffer; + + va_start(args, format); + length = vsnprintf(NULL, 0, format, args); + va_end(args); + + buffer = malloc(sizeof(char) * (length + 1)); + + va_start(args, format); + length = vsnprintf(buffer, length + 1, format, args); + va_end(args); + buffer[length] = 0; + + syslog(priority, "%s", buffer); +} + +// Function definitions +