Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

lcas_log.c File Reference

Logging routines for LCAS. More...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdarg.h>
#include <syslog.h>
#include <time.h>
#include <ctype.h>
#include "_lcas_log.h"

Go to the source code of this file.

Defines

#define DEBUG_LEVEL   0

Functions

int lcas_log_open (char *path, FILE *fp, unsigned short logtype)
 Start logging.

int lcas_log (int prty, char *fmt,...)
 log information

int lcas_log_a_string (int prty, char *fmt, char *the_string)
 log information

int lcas_log_debug (int debug_lvl, char *fmt,...)
 Print debugging information.

int lcas_log_a_string_debug (int debug_lvl, char *fmt, char *the_string)
 Print debugging information.

int lcas_log_close ()
 Stop logging.

int lcas_log_time (int prty, char *fmt,...)
 log information with timestamp

int lcas_get_debug_level ()
 Retrieve the debug_level.


Variables

FILE * lcas_logfp = NULL
int logging_usrlog = 0
int logging_syslog = 0
int debug_level = 0
char * extra_logstr = NULL
int should_close_lcas_logfp = 0


Detailed Description

Logging routines for LCAS.

Author:
Martijn Steenbakkers for the EU DataGrid.

Definition in file lcas_log.c.


Define Documentation

#define DEBUG_LEVEL   0
 

default debugging level

Definition at line 42 of file lcas_log.c.

Referenced by lcas_log_open().


Function Documentation

int lcas_get_debug_level  ) 
 

Retrieve the debug_level.

Returns:
the debug_level

Definition at line 471 of file lcas_log.c.

References debug_level.

Referenced by lcas_check_gacl().

int lcas_log int  prty,
char *  fmt,
... 
 

log information

This function does the logging for the LCAS and its plugins. Syslog() is called with the specified priority. No syslog() is done if the priority is 0.

Parameters:
prty syslog priority (if 0 don't syslog).
fmt string format
... variable argument list
Return values:
0 succes.
1 failure.

Definition at line 181 of file lcas_log.c.

References extra_logstr, lcas_logfp, logging_syslog, logging_usrlog, and MAX_LOG_BUFFER_SIZE.

Referenced by clean_plugin_list(), get_procsymbol(), lcas_check_gacl(), lcas_cleanVoData(), lcas_createVoData(), lcas_db_clean(), lcas_db_fill_entry(), lcas_db_parse_line(), lcas_db_parse_pair(), lcas_db_parse_string(), lcas_db_read(), lcas_deleteVoData(), lcas_gacl_add_dn(), lcas_gacl_add_vomsdata(), lcas_get_fabric_authorization(), lcas_init_and_logfile(), lcas_log_debug(), lcas_log_open(), lcas_stringVoData(), lcas_term(), parse_args_plugin(), plugin_confirm_authorization(), plugin_initialize(), and PluginInit().

int lcas_log_a_string int  prty,
char *  fmt,
char *  the_string
 

log information

This function logs information for LCAS and its plugins. Syslog() is called with the specified priority. No syslog() is done if the priority is 0.

Parameters:
prty syslog priority (if 0 don't syslog).
fmt string format
the_string the string
Return values:
0 succes.
1 failure.

Definition at line 250 of file lcas_log.c.

References extra_logstr, lcas_logfp, logging_syslog, logging_usrlog, and MAX_LOG_BUFFER_SIZE.

Referenced by lcas_log_a_string_debug().

int lcas_log_a_string_debug int  debug_lvl,
char *  fmt,
char *  the_string
 

Print debugging information.

This function prints debugging information (using lcas_log with priority 0) provided debug_lvl <= DEBUG_LEVEL (default is 0).

Parameters:
debug_lvl debugging level
fmt string format
the_string the string
Return values:
0 succes.
1 failure.

Definition at line 347 of file lcas_log.c.

References debug_level, and lcas_log_a_string().

int lcas_log_debug int  debug_lvl,
char *  fmt,
... 
 

Print debugging information.

This function prints debugging information (using lcas_log with priority 0) provided debug_lvl <= DEBUG_LEVEL (default is 0).

Parameters:
debug_lvl debugging level
fmt string format
... variable argument list
Return values:
0 succes.
1 failure.

Definition at line 296 of file lcas_log.c.

References debug_level, lcas_log(), and MAX_LOG_BUFFER_SIZE.

Referenced by clean_plugin_list(), lcas_check_gacl(), lcas_db_clean_list(), lcas_db_fill_entry(), lcas_db_parse_line(), lcas_db_read_entries(), lcas_deleteVoData(), lcas_gacl_add_dn(), lcas_gacl_add_vomsdata(), lcas_get_fabric_authorization(), lcas_init_and_logfile(), lcas_printVoData(), lcas_term(), parse_args_plugin(), plugin_confirm_authorization(), plugin_initialize(), plugin_terminate(), PluginInit(), and print_lcas_plugin().

int lcas_log_open char *  path,
FILE *  fp,
unsigned short  logtype
 

Start logging.

This function should only be used by the LCAS itself. It opens the logfile and tries to set the debugging level in the following order:

  1. Try if DEBUG_LEVEL > 0
  2. Try if environment variable LCAS_DEBUG_LEVEL is set and if it is an integer > 0
  3. Otherwise set debug_level = 0;

Parameters:
path path of logfile.
fp file pointer to already opened file (or NULL)
logtype DO_USRLOG, DO_SYSLOG
Return values:
0 succes.
1 failure.

Definition at line 66 of file lcas_log.c.

References debug_level, DEBUG_LEVEL, DO_SYSLOG, DO_USRLOG, extra_logstr, lcas_log(), lcas_logfp, logging_syslog, logging_usrlog, and should_close_lcas_logfp.

Referenced by lcas_init_and_logfile().

int lcas_log_time int  prty,
char *  fmt,
... 
 

log information with timestamp

This function logs information with a timestamp for LCAS and its plugins. Syslog() is called with the specified priority. No syslog() is done if the priority is 0.

Parameters:
prty syslog priority (if 0 don't syslog).
fmt string format
... variable argument list
Return values:
0 succes.
1 failure.

Definition at line 392 of file lcas_log.c.

References extra_logstr, lcas_logfp, logging_syslog, logging_usrlog, and MAX_LOG_BUFFER_SIZE.

Referenced by lcas_get_fabric_authorization(), lcas_init_and_logfile(), and lcas_term().


Variable Documentation

int debug_level = 0 [static]
 

debugging level

Definition at line 51 of file lcas_log.c.

Referenced by lcas_get_debug_level(), lcas_log_a_string_debug(), lcas_log_debug(), and lcas_log_open().

char* extra_logstr = NULL [static]
 

string to be included in every log statement

Definition at line 52 of file lcas_log.c.

Referenced by lcas_log(), lcas_log_a_string(), lcas_log_close(), lcas_log_open(), and lcas_log_time().

FILE* lcas_logfp = NULL [static]
 

stream associated with logfile

Definition at line 48 of file lcas_log.c.

Referenced by lcas_log(), lcas_log_a_string(), lcas_log_close(), lcas_log_open(), and lcas_log_time().

int logging_syslog = 0 [static]
 

flag to use syslog

Definition at line 50 of file lcas_log.c.

Referenced by lcas_log(), lcas_log_a_string(), lcas_log_open(), and lcas_log_time().

int logging_usrlog = 0 [static]
 

flag to do user logging

Definition at line 49 of file lcas_log.c.

Referenced by lcas_log(), lcas_log_a_string(), lcas_log_open(), and lcas_log_time().

int should_close_lcas_logfp = 0 [static]
 

Flag to check if the log stream should be closed

Definition at line 53 of file lcas_log.c.

Referenced by lcas_log_close(), and lcas_log_open().


Generated on Fri May 27 18:10:49 2005 for lcas by doxygen 1.3.5