nfs-ganesha 1.4
Classes | Defines | Typedefs | Functions | Variables

log_functions.c File Reference

#include <stdlib.h>
#include <ctype.h>
#include <pthread.h>
#include <stdio.h>
#include <stdarg.h>
#include <unistd.h>
#include <fcntl.h>
#include <time.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
#include <libgen.h>
#include "log.h"

Go to the source code of this file.

Classes

struct  ThreadLogContext_t

Defines

#define STR_LEN_TXT   2048
#define PATH_LEN   1024
#define MAX_STR_LEN   1024
#define MAX_NUM_FAMILY   50
#define UNUSED_SLOT   -1
#define ARRAY_SIZE(a)   (sizeof(a)/sizeof(a[0]))
#define LogChanges(format, args...)
#define Localtime_r   localtime_r
#define ONE_STEP   do { iterformat +=1 ; len += 1; } while(0)
#define NO_TYPE   0
#define INT_TYPE   1
#define LONG_TYPE   2
#define CHAR_TYPE   3
#define STRING_TYPE   4
#define FLOAT_TYPE   5
#define DOUBLE_TYPE   6
#define POINTEUR_TYPE   7
#define EXTENDED_TYPE   8
#define STATUS_SHORT   1
#define STATUS_LONG   2
#define CONTEXTE_SHORT   3
#define CONTEXTE_LONG   4
#define ERREUR_SHORT   5
#define ERREUR_LONG   6
#define ERRNUM_SHORT   7
#define ERRNUM_LONG   8
#define ERRCTX_SHORT   9
#define ERRCTX_LONG   10
#define CHANGE_ERR_FAMILY   11
#define CHANGE_CTX_FAMILY   12
#define ERRNO_SHORT   13
#define ERRNO_LONG   14
#define NO_LONG   0
#define SHORT_LG   1
#define LONG_LG   2
#define LONG_LONG_LG   3
#define MAX_STR_TOK   LOG_MAX_STRLEN

Typedefs

typedef struct ThreadLogContext_t ThreadLogContext_t

Functions

errctx_t __attribute__ ((__unused__))
void RegisterCleanup (cleanup_list_element *clean)
void Cleanup (void)
void Fatal (void)
void GetNameFunction (char *name, int len)
int ReturnLevelAscii (const char *LevelEnAscii)
char * ReturnLevelInt (int level)
void SetNamePgm (char *nom)
void SetNameHost (char *nom)
void SetNameFunction (char *nom)
void SetComponentLogLevel (log_components_t component, int level_to_set)
int ReturnLevelDebug ()
void _SetLevelDebug (int level_to_set)
void SetLevelDebug (int level_to_set)
void InitLogging ()
int AddFamilyError (int num_family, char *name_family, family_error_t *tab_err)
char * ReturnNameFamilyError (int num_family)
int MakeLogError (char *buffer, int num_family, int num_error, int status, int ma_ligne)
int log_vsnprintf (char *out, size_t taille, char *format, va_list arguments)
int log_snprintf (char *out, size_t n, char *format,...)
int log_fprintf (FILE *file, char *format,...)
int DisplayLogComponentLevel (log_components_t component, char *function, log_levels_t level, char *format,...)
int DisplayErrorComponentLogLine (log_components_t component, char *function, int num_family, int num_error, int status, int ma_ligne)
void SetDefaultLogging (char *name)
int SetComponentLogFile (log_components_t component, char *name)
void SetComponentLogBuffer (log_components_t component, char *buffer)
void rpc_warnx (char *fmt,...)

Variables

log_level_t tabLogLevel []
cleanup_list_elementcleanup_list = NULL
const char * emergency = "* log emergency *"

Define Documentation

#define ARRAY_SIZE (   a)    (sizeof(a)/sizeof(a[0]))

Definition at line 73 of file log_functions.c.

#define CHANGE_CTX_FAMILY   12

Definition at line 836 of file log_functions.c.

#define CHANGE_ERR_FAMILY   11

Definition at line 835 of file log_functions.c.

#define CHAR_TYPE   3

Definition at line 816 of file log_functions.c.

#define CONTEXTE_LONG   4

Definition at line 828 of file log_functions.c.

#define CONTEXTE_SHORT   3

Definition at line 827 of file log_functions.c.

#define DOUBLE_TYPE   6

Definition at line 819 of file log_functions.c.

#define ERRCTX_LONG   10

Definition at line 834 of file log_functions.c.

#define ERRCTX_SHORT   9

Definition at line 833 of file log_functions.c.

#define ERREUR_LONG   6

Definition at line 830 of file log_functions.c.

#define ERREUR_SHORT   5

Definition at line 829 of file log_functions.c.

#define ERRNO_LONG   14

Definition at line 838 of file log_functions.c.

#define ERRNO_SHORT   13

Definition at line 837 of file log_functions.c.

#define ERRNUM_LONG   8

Definition at line 832 of file log_functions.c.

#define ERRNUM_SHORT   7

Definition at line 831 of file log_functions.c.

#define EXTENDED_TYPE   8

Definition at line 823 of file log_functions.c.

#define FLOAT_TYPE   5

Definition at line 818 of file log_functions.c.

#define INT_TYPE   1

Definition at line 814 of file log_functions.c.

#define Localtime_r   localtime_r

Definition at line 248 of file log_functions.c.

#define LogChanges (   format,
  args... 
)
Value:
do { \
    if (LogComponents[COMPONENT_LOG].comp_log_type != TESTLOG || \
        LogComponents[COMPONENT_LOG].comp_log_level == NIV_FULL_DEBUG) \
      DisplayLogComponentLevel(COMPONENT_LOG, (char *)__FUNCTION__, \
                               NIV_NULL, "LOG: " format, ## args ); \
  } while (0)

Definition at line 184 of file log_functions.c.

#define LONG_LG   2

Definition at line 842 of file log_functions.c.

#define LONG_LONG_LG   3

Definition at line 843 of file log_functions.c.

#define LONG_TYPE   2

Definition at line 815 of file log_functions.c.

#define MAX_NUM_FAMILY   50

Definition at line 55 of file log_functions.c.

#define MAX_STR_LEN   1024

Definition at line 54 of file log_functions.c.

#define MAX_STR_TOK   LOG_MAX_STRLEN

Definition at line 845 of file log_functions.c.

#define NO_LONG   0

Definition at line 840 of file log_functions.c.

#define NO_TYPE   0

Definition at line 813 of file log_functions.c.

#define ONE_STEP   do { iterformat +=1 ; len += 1; } while(0)

Definition at line 811 of file log_functions.c.

#define PATH_LEN   1024

Definition at line 53 of file log_functions.c.

#define POINTEUR_TYPE   7

Definition at line 820 of file log_functions.c.

#define SHORT_LG   1

Definition at line 841 of file log_functions.c.

#define STATUS_LONG   2

Definition at line 826 of file log_functions.c.

#define STATUS_SHORT   1

Definition at line 825 of file log_functions.c.

#define STR_LEN_TXT   2048

Definition at line 52 of file log_functions.c.

#define STRING_TYPE   4

Definition at line 817 of file log_functions.c.

#define UNUSED_SLOT   -1

Definition at line 56 of file log_functions.c.


Typedef Documentation


Function Documentation

void _SetLevelDebug ( int  level_to_set)

Definition at line 456 of file log_functions.c.

int AddFamilyError ( int  num_family,
char *  name_family,
family_error_t tab_err 
)

Definition at line 698 of file log_functions.c.

void Cleanup ( void  )

Definition at line 200 of file log_functions.c.

int DisplayErrorComponentLogLine ( log_components_t  component,
char *  function,
int  num_family,
int  num_error,
int  status,
int  ma_ligne 
)

Definition at line 1164 of file log_functions.c.

int DisplayLogComponentLevel ( log_components_t  component,
char *  function,
log_levels_t  level,
char *  format,
  ... 
)

Definition at line 1123 of file log_functions.c.

void Fatal ( void  )

Definition at line 210 of file log_functions.c.

void GetNameFunction ( char *  name,
int  len 
)

Definition at line 323 of file log_functions.c.

void InitLogging ( )

Definition at line 494 of file log_functions.c.

int log_fprintf ( FILE *  file,
char *  format,
  ... 
)

Definition at line 866 of file log_functions.c.

int log_snprintf ( char *  out,
size_t  n,
char *  format,
  ... 
)

Definition at line 854 of file log_functions.c.

int log_vsnprintf ( char *  out,
size_t  taille,
char *  format,
va_list  arguments 
)

Definition at line 847 of file log_functions.c.

int MakeLogError ( char *  buffer,
int  num_family,
int  num_error,
int  status,
int  ma_ligne 
)

Definition at line 780 of file log_functions.c.

void RegisterCleanup ( cleanup_list_element clean)

Definition at line 194 of file log_functions.c.

int ReturnLevelAscii ( const char *  LevelEnAscii)

Definition at line 339 of file log_functions.c.

int ReturnLevelDebug ( ) [inline]

Definition at line 451 of file log_functions.c.

char* ReturnLevelInt ( int  level)

Definition at line 351 of file log_functions.c.

char* ReturnNameFamilyError ( int  num_family)

Definition at line 726 of file log_functions.c.

void rpc_warnx ( char *  fmt,
  ... 
)

Definition at line 1315 of file log_functions.c.

void SetComponentLogBuffer ( log_components_t  component,
char *  buffer 
)

Definition at line 1305 of file log_functions.c.

int SetComponentLogFile ( log_components_t  component,
char *  name 
)

Definition at line 1259 of file log_functions.c.

void SetComponentLogLevel ( log_components_t  component,
int  level_to_set 
)

Definition at line 427 of file log_functions.c.

void SetDefaultLogging ( char *  name)

Definition at line 1244 of file log_functions.c.

void SetLevelDebug ( int  level_to_set)

Definition at line 470 of file log_functions.c.

void SetNameFunction ( char *  nom)

Definition at line 387 of file log_functions.c.

void SetNameHost ( char *  nom)

Definition at line 377 of file log_functions.c.

void SetNamePgm ( char *  nom)

Definition at line 366 of file log_functions.c.


Variable Documentation

Definition at line 192 of file log_functions.c.

const char* emergency = "* log emergency *"

Definition at line 261 of file log_functions.c.

Initial value:
{
  {NIV_NULL,       "NIV_NULL",       "NULL",       LOG_NOTICE},
  {NIV_FATAL,      "NIV_FATAL",      "FATAL",      LOG_CRIT},
  {NIV_MAJ,        "NIV_MAJ",        "MAJ",        LOG_CRIT},
  {NIV_CRIT,       "NIV_CRIT",       "CRIT",       LOG_ERR},
  {NIV_WARN,       "NIV_WARN",       "WARN",       LOG_WARNING},
  {NIV_EVENT,      "NIV_EVENT",      "EVENT",      LOG_NOTICE},
  {NIV_INFO,       "NIV_INFO",       "INFO",       LOG_INFO},
  {NIV_DEBUG,      "NIV_DEBUG",      "DEBUG",      LOG_DEBUG},
  {NIV_MID_DEBUG,  "NIV_MID_DEBUG",  "MID_DEBUG",  LOG_DEBUG},
  {NIV_FULL_DEBUG, "NIV_FULL_DEBUG", "FULL_DEBUG", LOG_DEBUG}
}

Definition at line 58 of file log_functions.c.