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

lcmaps_log.c File Reference

Logging routines for LCMAPS. 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 "_lcmaps_log.h"

Go to the source code of this file.

Defines

#define DEBUG_LEVEL   0

Functions

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

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

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

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

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

int lcmaps_log_close ()
 Stop logging.

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


Variables

FILE * lcmaps_logfp = NULL
int logging_usrlog = 0
int logging_syslog = 0
int debug_level = 0
char * extra_logstr = NULL
int should_close_lcmaps_logfp = 0


Detailed Description

Logging routines for LCMAPS.

Author:
Martijn Steenbakkers for the EU DataGrid.

Definition in file lcmaps_log.c.


Define Documentation

#define DEBUG_LEVEL   0
 

default debugging level

Definition at line 42 of file lcmaps_log.c.

Referenced by lcmaps_log_open().


Function Documentation

int lcmaps_log int  prty,
char *  fmt,
... 
 

log information

This function logs information for LCMAPS 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 224 of file lcmaps_log.c.

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

Referenced by check_argument(), clean_plugin_list(), construct_argv(), get_plugins(), get_procsymbol(), getPluginNameAndArgs(), lcmaps_add_username_to_ldapgroup(), lcmaps_cleanVoData(), lcmaps_cleanVoMapping(), lcmaps_createVoData(), lcmaps_createVoMapping(), lcmaps_db_clean(), lcmaps_db_fill_entry(), lcmaps_db_parse_line(), lcmaps_db_parse_pair(), lcmaps_db_parse_string(), lcmaps_db_read(), lcmaps_deleteVoData(), lcmaps_deleteVoMapping(), lcmaps_extractRunVars(), lcmaps_get_gidlist(), lcmaps_get_jobrep_config(), lcmaps_get_ldap_pw(), lcmaps_init_and_logfile(), lcmaps_log_debug(), lcmaps_log_open(), lcmaps_run(), lcmaps_run_and_return_poolindex(), lcmaps_run_and_return_username(), lcmaps_run_with_fqans_and_return_account(), lcmaps_run_without_credentials_and_return_username(), lcmaps_set_pgid(), lcmaps_stringVoData(), parse_args_plugin(), PluginInit(), run_cmd(), runEvaluationManager(), runPlugin(), runPluginManager(), startPluginManager(), stopPluginManager(), and warning().

int lcmaps_log_a_string int  prty,
char *  fmt,
char *  the_string
 

log information

This function logs information for LCMAPS 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 293 of file lcmaps_log.c.

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

Referenced by lcmaps_log_a_string_debug().

int lcmaps_log_a_string_debug int  debug_lvl,
char *  fmt,
char *  the_string
 

Print debugging information.

This function prints debugging information (using lcmaps_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 408 of file lcmaps_log.c.

References debug_level, and lcmaps_log_a_string().

Referenced by lcmaps_run_and_return_poolindex(), lcmaps_run_with_fqans_and_return_account(), and printCredData().

int lcmaps_log_debug int  debug_lvl,
char *  fmt,
... 
 

Print debugging information.

This function prints debugging information (using lcmaps_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 357 of file lcmaps_log.c.

References debug_level, lcmaps_log(), and MAX_LOG_BUFFER_SIZE.

Referenced by check_policies_for_recursion(), clean_plugin_list(), construct_argv(), free_plugins(), get_plugins(), getPluginNameAndArgs(), lcmaps_add_username_to_ldapgroup(), lcmaps_db_clean_list(), lcmaps_db_fill_entry(), lcmaps_db_parse_line(), lcmaps_db_read_entries(), lcmaps_deleteVoData(), lcmaps_deleteVoMapping(), lcmaps_extractRunVars(), lcmaps_get_gidlist(), lcmaps_get_jobrep_config(), lcmaps_get_ldap_pw(), lcmaps_init_and_logfile(), lcmaps_printVoData(), lcmaps_printVoMapping(), lcmaps_run_and_return_poolindex(), lcmaps_run_and_return_username(), lcmaps_run_with_fqans_and_return_account(), lcmaps_run_without_credentials_and_return_username(), lcmaps_set_pgid(), lcmaps_setRunVars(), parse_args_plugin(), pdl_next_plugin(), plugin_initialize(), plugin_introspect(), plugin_run(), plugin_terminate(), PluginInit(), print_lcmaps_plugin(), printCredData(), resetCredentialData(), run_cmd(), runEvaluationManager(), runPlugin(), runPluginManager(), show_policies(), show_rules(), show_variables(), startPluginManager(), stopEvaluationManager(), and stopPluginManager().

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

Start logging.

This function should only be used by the LCMAPS 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 LCMAPS_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 89 of file lcmaps_log.c.

References debug_level, DEBUG_LEVEL, DO_SYSLOG, DO_USRLOG, extra_logstr, lcmaps_log(), lcmaps_logfp, logging_syslog, logging_usrlog, and should_close_lcmaps_logfp.

Referenced by lcmaps_init_and_logfile().

int lcmaps_log_time int  prty,
char *  fmt,
... 
 

log information with timestamp

This function logs information with a timestamp for LCMAPS 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 484 of file lcmaps_log.c.

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

Referenced by lcmaps_init_and_logfile(), lcmaps_run(), lcmaps_run_and_return_poolindex(), lcmaps_run_and_return_username(), lcmaps_run_with_fqans_and_return_account(), lcmaps_run_without_credentials_and_return_username(), lcmaps_term(), runPlugin(), and startPluginManager().


Variable Documentation

int debug_level = 0 [static]
 

debugging level

Definition at line 52 of file lcmaps_log.c.

Referenced by lcmaps_log_a_string_debug(), lcmaps_log_debug(), and lcmaps_log_open().

char* extra_logstr = NULL [static]
 

string to be included in every log statement

Definition at line 53 of file lcmaps_log.c.

Referenced by lcmaps_log(), lcmaps_log_a_string(), lcmaps_log_close(), lcmaps_log_open(), and lcmaps_log_time().

FILE* lcmaps_logfp = NULL [static]
 

stream associated with logfile

Definition at line 48 of file lcmaps_log.c.

Referenced by lcmaps_log(), lcmaps_log_a_string(), lcmaps_log_close(), lcmaps_log_open(), and lcmaps_log_time().

int logging_syslog = 0 [static]
 

flag to use syslog

Definition at line 50 of file lcmaps_log.c.

Referenced by lcmaps_log(), lcmaps_log_a_string(), lcmaps_log_open(), and lcmaps_log_time().

int logging_usrlog = 0 [static]
 

flag to do user logging

Definition at line 49 of file lcmaps_log.c.

Referenced by lcmaps_log(), lcmaps_log_a_string(), lcmaps_log_open(), and lcmaps_log_time().

int should_close_lcmaps_logfp = 0 [static]
 

Flag to check if the log stream should be closed

Definition at line 54 of file lcmaps_log.c.

Referenced by lcmaps_log_close(), and lcmaps_log_open().


Generated on Sun May 29 21:22:12 2005 for lcmaps by doxygen 1.3.5