Back to index

php5  5.3.10
Defines | Enumerations | Functions
zlog.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define zlog(flags,...)   zlog_ex(__func__, __LINE__, flags, __VA_ARGS__)
#define ZLOG_LEVEL_MASK   7
#define ZLOG_HAVE_ERRNO   0x100
#define ZLOG_SYSERROR   (ZLOG_ERROR | ZLOG_HAVE_ERRNO)

Enumerations

enum  {
  ZLOG_DEBUG = 1, ZLOG_NOTICE = 2, ZLOG_WARNING = 3, ZLOG_ERROR = 4,
  ZLOG_ALERT = 5
}

Functions

int zlog_set_fd (int new_fd)
int zlog_set_level (int new_value)
const char * zlog_get_level_name (int log_level)
void zlog_set_launched (void)
size_t zlog_print_time (struct timeval *tv, char *timebuf, size_t timebuf_len)
void zlog_ex (const char *function, int line, int flags, const char *fmt,...) __attribute__((format(printf

Define Documentation

#define zlog (   flags,
  ... 
)    zlog_ex(__func__, __LINE__, flags, __VA_ARGS__)

Definition at line 8 of file zlog.h.

#define ZLOG_HAVE_ERRNO   0x100

Definition at line 36 of file zlog.h.

#define ZLOG_LEVEL_MASK   7

Definition at line 34 of file zlog.h.

Definition at line 38 of file zlog.h.


Enumeration Type Documentation

anonymous enum
Enumerator:
ZLOG_DEBUG 
ZLOG_NOTICE 
ZLOG_WARNING 
ZLOG_ERROR 
ZLOG_ALERT 

Definition at line 26 of file zlog.h.

     {
       ZLOG_DEBUG                  = 1,
       ZLOG_NOTICE                 = 2,
       ZLOG_WARNING         = 3,
       ZLOG_ERROR                  = 4,
       ZLOG_ALERT                  = 5,
};

Function Documentation

void zlog_ex ( const char *  function,
int  line,
int  flags,
const char *  fmt,
  ... 
)
const char* zlog_get_level_name ( int  log_level)

Definition at line 44 of file zlog.c.

{
       if (log_level < 0) {
              log_level = zlog_level;
       } else if (log_level < ZLOG_DEBUG || log_level > ZLOG_ALERT) {
              return "unknown value";
       }

       return level_names[log_level];
}

Here is the caller graph for this function:

size_t zlog_print_time ( struct timeval *  tv,
char *  timebuf,
size_t  timebuf_len 
)

Definition at line 60 of file zlog.c.

{
       struct tm t;
       size_t len;

       len = strftime(timebuf, timebuf_len, "[%d-%b-%Y %H:%M:%S", localtime_r((const time_t *) &tv->tv_sec, &t));
       if (zlog_level == ZLOG_DEBUG) {
              len += snprintf(timebuf + len, timebuf_len - len, ".%06d", (int) tv->tv_usec);
       }
       len += snprintf(timebuf + len, timebuf_len - len, "] ");
       return len;
}

Here is the caller graph for this function:

int zlog_set_fd ( int  new_fd)

Definition at line 74 of file zlog.c.

{
       int old_fd = zlog_fd;

       zlog_fd = new_fd;
       return old_fd;
}

Here is the caller graph for this function:

void zlog_set_launched ( void  )

Definition at line 56 of file zlog.c.

                             {
       launched = 1;
}

Here is the caller graph for this function:

int zlog_set_level ( int  new_value)

Definition at line 83 of file zlog.c.

{
       int old_value = zlog_level;

       if (new_value < ZLOG_DEBUG || new_value > ZLOG_ALERT) return old_value;

       zlog_level = new_value;
       return old_value;
}

Here is the caller graph for this function: