log.c File Reference

#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <time.h>
#include "config.h"
#include <errno.h>
#include "log.h"
#include "util.h"
#include "common.h"
#include "hashtable.h"

Go to the source code of this file.

Data Structures

struct  _error_code_legend
#define PRECISE_TIME_FACTOR   1000
#define LINELEN   81
#define CHARS_PER_LINE   16
typedef _error_code_legend error_code_legend
int cp_log_init (char *filename, int verbosity)
int cp_log_reopen ()
int cp_log_close ()
void cp_log (const char *fmt,...)
void cp_nlog (size_t len, const char *fmt,...)
void cp_log_set_time_format (char *time_format)
void cp_debug (char *fmt,...)
void cp_debuginfo (char *fmt,...)
void cp_info (char *fmt,...)
void cp_warn (char *fmt,...)
void cp_error (int code, char *fmt,...)
void cp_perror (int code, int errno_code, char *fmt,...)
void cp_fatal (int code, char *fmt,...)
void die (int code, const char *fmt,...)
void cp_dump (int levelprm, cp_string *str)
void cp_ndump (int levelprm, cp_string *str, size_t len)
long thread_count
error_code_legend error_messages []


Detailed Description

libcprops logging facilities implementation

Definition in file log.c.


Function Documentation

void cp_dump ( int  log_level,
cp_string str 
)

hex dump a cp_string

Definition at line 669 of file log.c.

References CHARS_PER_LINE, and LINELEN.

Referenced by cp_ndump().

void cp_error ( int  code,
char *  msg,
  ... 
)

print out a LOG_LEVEL_ERROR log message

Definition at line 467 of file log.c.

References cp_hashtable_get(), and LOG_LEVEL_ERROR.

Referenced by cp_client_connect(), cp_client_reopen(), cp_client_write(), cp_connection_descriptor_create(), cp_connection_descriptor_write(), cp_connection_descrpitor_read(), cp_db_connection_close_statement(), cp_db_connection_commit(), cp_db_connection_escape_binary(), cp_db_connection_escape_string(), cp_db_connection_pool_create(), cp_db_connection_prepare_statement(), cp_db_connection_rollback(), cp_db_connection_set_autocommit(), cp_db_connection_set_fetch_size(), cp_db_connection_set_read_result_set_at_once(), cp_db_connection_unescape_binary(), cp_dbms_get_data_source(), cp_dbms_get_data_source_prm(), cp_http_service_create(), cp_http_thread_fn(), cp_httpclient_fetch_ctl_exec(), cp_httpclient_init(), cp_httpsocket_create(), cp_index_map_reindex(), cp_multimap_find_by_index(), cp_multimap_get_by_index(), cp_multimap_remove_by_index(), cp_pooled_thread_create(), cp_pooled_thread_run_task(), cp_result_set_get_field_types(), cp_result_set_get_headers(), cp_result_set_next(), cp_socket_create(), cp_socket_select_callback_impl(), cp_socket_select_threadpool_impl(), cp_string_create(), cp_thread_pool_create(), and cp_url_descriptor_parse().

void cp_fatal ( int  code,
char *  msg,
  ... 
)

print out a LOG_LEVEL_FATAL log message and exit. if log_level is LOG_LEVEL_SILENT, the error message is supressed but the process still exits.

Definition at line 570 of file log.c.

References cp_log_close(), and LOG_LEVEL_FATAL.

Referenced by cp_client_init(), cp_pooled_thread_client_interface_create(), cp_pooled_thread_scheduler_create(), cp_thread_pool_create(), and die().

void cp_log ( const char *  msg,
  ... 
)

unconditionally log a message

Definition at line 244 of file log.c.

Referenced by cp_http_response_write(), and die().

void cp_ndump ( int  log_level,
cp_string str,
size_t  len 
)

hex dump up to len bytes of a cp_string

Definition at line 730 of file log.c.

References cp_dump().

Referenced by cp_http_response_write().

void cp_nlog ( size_t  len,
const char *  msg,
  ... 
)

unconditionally log a limited length message

Definition at line 259 of file log.c.

Referenced by cp_http_response_write().

void cp_perror ( int  code,
int  errno_code,
char *  msg,
  ... 
)

print out a LOG_LEVEL_ERROR log message with an errno code

Definition at line 511 of file log.c.

References cp_hashtable_get(), and LOG_LEVEL_ERROR.

Referenced by cp_client_close(), cp_client_create(), cp_client_reopen(), cp_http_thread_fn(), cp_index_map_reindex(), cp_socket_connection_close(), cp_socket_listen(), cp_socket_select_callback_impl(), and cp_socket_select_threadpool_impl().

void cp_warn ( char *  msg,
  ... 
)

print out a LOG_LEVEL_WARNING log message

Definition at line 453 of file log.c.

References LOG_LEVEL_WARNING.

Referenced by cp_http_service_delete().


Generated on Mon Dec 5 23:00:22 2011 for cprops by  doxygen 1.4.7