2007-01-03 05:42:32 -05:00
|
|
|
/*
|
|
|
|
|
* util/log.h - logging service
|
|
|
|
|
*
|
|
|
|
|
* Copyright (c) 2007, NLnet Labs. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* See LICENSE for the license.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2007-01-03 09:55:21 -05:00
|
|
|
/**
|
|
|
|
|
* \file
|
|
|
|
|
*
|
|
|
|
|
* This file contains logging functions.
|
|
|
|
|
*/
|
|
|
|
|
|
2007-01-03 05:42:32 -05:00
|
|
|
#ifndef UTIL_LOG_H
|
|
|
|
|
#define UTIL_LOG_H
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
#ifdef HAVE_STDARG_H
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/**
|
2007-01-03 09:55:21 -05:00
|
|
|
* call this to initialize logging services.
|
2007-01-03 05:42:32 -05:00
|
|
|
*/
|
|
|
|
|
void log_init();
|
|
|
|
|
|
|
|
|
|
/**
|
2007-01-23 08:46:18 -05:00
|
|
|
* Log informational message.
|
2007-01-03 05:42:32 -05:00
|
|
|
* Pass printf formatted arguments. No trailing newline is needed.
|
2007-01-03 09:55:21 -05:00
|
|
|
* @param format: printf-style format string. Arguments follow.
|
2007-01-03 05:42:32 -05:00
|
|
|
*/
|
|
|
|
|
void log_info(const char* format, ...) ATTR_FORMAT(printf, 1, 2);
|
|
|
|
|
|
2007-01-23 08:46:18 -05:00
|
|
|
/**
|
|
|
|
|
* Log error message.
|
|
|
|
|
* Pass printf formatted arguments. No trailing newline is needed.
|
|
|
|
|
* @param format: printf-style format string. Arguments follow.
|
|
|
|
|
*/
|
|
|
|
|
void log_err(const char* format, ...) ATTR_FORMAT(printf, 1, 2);
|
|
|
|
|
|
2007-01-03 05:42:32 -05:00
|
|
|
/**
|
|
|
|
|
* va_list argument version of log_info.
|
2007-01-23 08:46:18 -05:00
|
|
|
* @param type: string to designate type of message (info, error).
|
2007-01-03 09:55:21 -05:00
|
|
|
* @param format: the printf style format to print. no newline.
|
|
|
|
|
* @param args: arguments for format string.
|
2007-01-03 05:42:32 -05:00
|
|
|
*/
|
2007-01-23 08:46:18 -05:00
|
|
|
void log_vmsg(const char* type, const char *format, va_list args);
|
2007-01-03 05:42:32 -05:00
|
|
|
|
|
|
|
|
#endif /* UTIL_LOG_H */
|