logging.h File Reference

Contains front-end APIs to syslog for daemons. More...


Defines

#define LOGGING_STDERR   (1<<0)
 logging info to stderr
#define LOGGING_SYSLOG   (1<<1)
 logging info to syslog
#define STRERROR_BUFSIZ   64

Typedefs

typedef void(* logging_log_func_t )(int severity, const char *tag, const char *lsname, const char **entry, const char *fmt, va_list)
 Callback function for use with logging_register_logfunc().

Functions

void logging (int severity, const char *format,...)
 In-place replacement for syslog library routine.
void vlogging (int severity, const char *format, va_list ap)
 In-place replacement for vsyslog library routine.
void logging_event (int severity, const char *tag, const char **entry, const char *format,...)
 Writes a log message using the registered logging callback function, or vsyslog if no callback function has been registered.
void logging_event_ls (int severity, const char *tag, const char *lsname, const char **entry, const char *format,...)
 Writes a log message using the registered logging callback function, or vsyslog if no callback function has been registered.
void vlogging_event (int severity, const char *tag, const char *lsname, const char **entry, const char *format, va_list ap)
 Writes a log message using the registered logging callback function, or vsyslog.
int logging_set_mode (int mode)
 Sets the system logging mode (syslog, stderr, nothing).
int logging_set_level (int level)
 Sets the minimum logged error message.
void logging_register_logfunc (logging_log_func_t func)
 Registers a callback function to be invoked for logging.


Detailed Description

Contains front-end APIs to syslog for daemons.


Function Documentation

void logging int  severity,
const char *  format,
  ...
 

In-place replacement for syslog library routine.

This function will log to stderr or to system log (via vlogging). This function is thread safe.

Parameters:
[in] severity Message severity level
[in] format Format string (printf-like)

void logging_event int  severity,
const char *  tag,
const char **  entry,
const char *  format,
  ...
 

Writes a log message using the registered logging callback function, or vsyslog if no callback function has been registered.

If a logging callback function has been registered, and an ERRMSG tag has been passed, then invoke the callback function, else invoke vsyslog. This API is thread safe.

Parameters:
[in] severity Message severity level
[in] tag TODO
[in] entry TODO
[in] format Format string (printf-like)

void logging_event_ls int  severity,
const char *  tag,
const char *  lsname,
const char **  entry,
const char *  format,
  ...
 

Writes a log message using the registered logging callback function, or vsyslog if no callback function has been registered.

If a logging callback function has been registered, and an ERRMSG_LS tag has been passed, then invoke the callback function, else invoke vsyslog. This API is thread safe.

Parameters:
[in] severity Message severity level
[in] tag Error message tag
[in] lsname Logical system name
[in] entry Array of attributes
[in] format Format string (printf-like)

void logging_register_logfunc logging_log_func_t  func  ) 
 

Registers a callback function to be invoked for logging.

If no callback function is registered, vsyslog will be used instead. This API is thread safe.

Parameters:
[in] func Callback function to be invoked

int logging_set_level int  level  ) 
 

Sets the minimum logged error message.

This function logs anything over a debug or info message, regardless of the level set by this function. This function is thread safe.

Parameters:
[in] level Minimum logged error message level
Returns:
The previous logging level.

int logging_set_mode int  mode  ) 
 

Sets the system logging mode (syslog, stderr, nothing).

The logging mode can be a combination of:

  • LOGGING_STDERR
  • LOGGING_SYSLOG
You can force the logging mode to "nothing" by setting the mode to 0.

The default logging mode is LOGGING_STDERR. This API is thread safe.

Parameters:
[in] mode Selected system log mode
Returns:
The previous system log mode

void vlogging int  severity,
const char *  format,
va_list  ap
 

In-place replacement for vsyslog library routine.

This function will log to stderr or to system log. This function is thread safe.

Parameters:
[in] severity Message severity level
[in] format Format string (printf-like)
[in] ap Variable argument list

void vlogging_event int  severity,
const char *  tag,
const char *  lsname,
const char **  entry,
const char *  format,
va_list  ap
 

Writes a log message using the registered logging callback function, or vsyslog.

If a logging callback function has been invoked, and an ERRMSG tag has been passed, then invoke the callback function, else invoke vsyslog. This API is thread safe.

Parameters:
[in] severity Message severity level
[in] tag Error message tag
[in] lsname Logical system name
[in] entry Array of attributes
[in] format Format string (printf-like)
[in] ap Variable argument list


2007-2009 Juniper Networks, Inc. All rights reserved. The information contained herein is confidential information of Juniper Networks, Inc., and may not be used, disclosed, distributed, modified, or copied without the prior written consent of Juniper Networks, Inc. in an express license. This information is subject to change by Juniper Networks, Inc. Juniper Networks, the Juniper Networks logo, and JUNOS are registered trademarks of Juniper Networks, Inc. in the United States and other countries. All other trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners.
Generated on Sun May 30 20:23:40 2010 for libjuniper by Doxygen 1.4.5