junos_trace.h File Reference

Syslog and trace APIs for use by JUNOS SDK applications. More...


Typedefs

typedef pic_daemon_trace_file_options_s pic_daemon_trace_file_options_t

Functions

void junos_trace (int msg_type, const char *fmt,...)
 API for Generating Trace Logs.
void junos_trace_free_pic_trace_file_info (pic_daemon_trace_file_options_t *pic_trace_file_info)
 Frees the memory allocated for pic_daemon_trace_file_options_t structure.
void junos_log (u_int32_t type, const char *tag, const char **tags_entry, const char *fmt,...)
void junos_trace_level (int msg_type, u_int32_t trace_level, const char *fmt,...)
 API for generating trace logs by trace level options.
void junos_tracev (int msg_type, const char *fmt, va_list ap)
 API for Generating Trace Logs by type.
void junos_tracev_level (int msg_type, u_int32_t trace_level, const char *fmt, va_list ap)
 API for generating trace logs by level.
int junos_trace_read_config (int check, const char **junos_trace_path)
 Reading Trace Configuration.
void junos_trace_disable_locking (void)
 API for disabling locks in junos_trace function flow.
int junos_trace_get_pic_trace_file_info (pic_daemon_trace_file_options_t **pic_trace_file_info, size_t *size)


Detailed Description

Syslog and trace APIs for use by JUNOS SDK applications.

The functions in this file provide an API for generating syslogs and trace logs within JUNOS.

Trace logs typically are used for debugging or monitoring the operations of a JUNOS daemon. These functions enable the daemon to read its trace configuration from the configuration database and to generate trace logs.


Function Documentation

void junos_trace int  msg_type,
const char *  fmt,
  ...
 

API for Generating Trace Logs.

This API is used for generating trace logs, which are typically used for debugging or monitoring the operations of a JUNOS daemon. The name of the file in which the logs are stored and its maximum size are configurable in the 'traceoptions' DDL object belonging to this daemon. As the trace file fills up, it is copied to a historical file, and new trace logs are written to a new file. The number of these historical files that are maintained is also configurable.

Individual logs may be assigned to a specific type. The types, as well as the macros used for identifying them, are defined in the 'flags' DDL object within the 'traceoptions' object. If a specific flag is configured, all trace logs belonging to the message type associated with that flag will be written to the log file. If the flag is not configured, logs of that type will not be written. This API is thread safe.

Parameters:
[in] msg_type Trace log type. Use the macro defined in the 'traceoptions' 'flag' DDL object for this daemon.
[in] fmt Printf style format string followed by associated arguments. Together, they define the log that is written to the trace file.
See also:
junos_tracev

void junos_trace_disable_locking void   ) 
 

API for disabling locks in junos_trace function flow.

This API is used for disabling the locks used in junos_trace function flow path. By default, locks are utilized in the junos_trace function if the JUNOS SDK application is multithreaded. The use of these locks can be disabled by this API.

void junos_trace_free_pic_trace_file_info pic_daemon_trace_file_options_t *  pic_trace_file_info  ) 
 

Frees the memory allocated for pic_daemon_trace_file_options_t structure.

Parameters:
[in] pic_trace_file_info Pointer to the memory allocated of type "pic_daemon_trace_file_options_t" to be freed
See also:
junos_trace_get_pic_trace_file_info

void junos_trace_level int  msg_type,
u_int32_t  trace_level,
const char *  fmt,
  ...
 

API for generating trace logs by trace level options.

This API generates trace logs filtered based on trace level options. The junos_trace API supports filtering by type, but not trace levels. The levels, as well as the macros used for identifying them, are defined in the 'level' DDL object within the 'traceoptions' object. If a specific level is configured, all trace logs belonging to the level will be written to the log file. The level version logs any messages with a log level at or below the configured log level. This API is thread safe.

Parameters:
[in] msg_type Trace log type.
[in] trace_level Trace level option. Specifies the level option that should be used for the filtering.
[in] fmt Printf-style format string followed by associated arguments.
See also:
junos_tracev_level

int junos_trace_read_config int  check,
const char **  sdk_trace_path
 

Reading Trace Configuration.

Use this API during the daemon's configuration processing to apply the traceoptions configuration to the daemon. The configuration database must already have been opened. This API should be called in the main thread.

Parameters:
[in] check Boolean indicating whether the configuration is being checked or applied
[in] sdk_trace_path DDL path to traceoptions configuration object
Returns:
0 indicating success; -1 indicating failure

void junos_tracev int  msg_type,
const char *  fmt,
va_list  ap
 

API for Generating Trace Logs by type.

This is a variable argument list form of the junos_trace function whose functions are similar to that of junos_trace. This API is thread safe.

Parameters:
[in] msg_type Trace log type.
[in] fmt Printf-style format string.
[in] ap Variable argument list pointer.
See also:
junos_trace

void junos_tracev_level int  msg_type,
u_int32_t  trace_level,
const char *  fmt,
va_list  ap
 

API for generating trace logs by level.

This is a variable argument list form of the junos_trace_level function whose functions are similar to that of junos_trace_level. This API is thread safe.

Parameters:
[in] msg_type Trace log type.
[in] trace_level Trace level option. Specifies the level option that should be used for the filtering.
[in] fmt Printf-style format string.
[in] ap Variable argument list pointer.
See also:
junos_trace_level


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:49 2010 for libjunos-sdk by Doxygen 1.4.5