cu/logging.h: Logging
[Basics]

Data Structures

struct  cu_log_facility

Defines

#define CU_LOG_FLAG_PERMANENT   1
#define CU_LOG_FLAG_TRANSIENT   2
#define CU_LOG_FLAG_DEBUG_FACILITY   4
#define CU_LOG_FACILITY_INITIALISER(severity, origin, keys, flags)   { severity, origin, flags, keys, NULL, NULL }

Enumerations

enum  cu_log_severity_t {
  CU_LOG_DEBUG, CU_LOG_INFO, CU_LOG_NOTICE, CU_LOG_WARNING,
  CU_LOG_ERROR, CU_LOG_FAILURE
}
enum  cu_log_origin_t { CU_LOG_LOGIC, CU_LOG_SYSTEM, CU_LOG_USER }

Functions

typedef cu_clop (cu_vlogf_t, void, cu_log_facility_t facility, cu_location_t loc, char const *fmt, va_list va)
typedef cu_clop (cu_log_binder_t, cu_bool_t, cu_log_facility_t new_facility)
cu_log_severity_t cu_log_facility_severity (cu_log_facility_t facility)
cu_log_origin_t cu_log_facility_origin (cu_log_facility_t facility)
unsigned int cu_log_facility_flags (cu_log_facility_t facility)
cu_log_binder_t cu_register_log_binder (cu_log_binder_t binder)
void cu_register_permanent_log (cu_log_facility_t facility)
void cu_register_transient_log (cu_log_facility_t facility)
void cu_vlogf (cu_log_facility_t facility, char const *fmt, va_list va)
void cu_logf (cu_log_facility_t facility, char const *fmt,...)
void cu_vlogf_at (cu_log_facility_t facility, cu_location_t loc, char const *fmt, va_list va)

Define Documentation

#define CU_LOG_FACILITY_INITIALISER ( severity,
origin,
keys,
flags   )     { severity, origin, flags, keys, NULL, NULL }

Expands to an initialiser for cu_log_facility.

#define CU_LOG_FLAG_DEBUG_FACILITY   4

Indicates a logging facility used for debugging.

#define CU_LOG_FLAG_PERMANENT   1

Facility flag to indicate process-long lifetime.

#define CU_LOG_FLAG_TRANSIENT   2

Facility flag to indicate transient lifetime.


Enumeration Type Documentation

A type which holds a hint about the origin of log messages.

A type whose values indicate the importance or severity of log messages.


Function Documentation

unsigned int cu_log_facility_flags ( cu_log_facility_t  facility  ) 

Various boolean properties of the logger in the form of an bitwise or of the CU_LOG_FLAG_* constants.

cu_log_origin_t cu_log_facility_origin ( cu_log_facility_t  facility  ) 

A hit of the origin of messages logged to this facility. This can be used by log binders to select the right channel and formatting, or to disable output.

cu_log_severity_t cu_log_facility_severity ( cu_log_facility_t  facility  ) 

The severity or importance of messages logged to this facility. This can be used by log binders to select the right channel and formatting, or to disable output.

void cu_logf ( cu_log_facility_t  facility,
char const *  fmt,
  ... 
)

Run the vlogf implementation of facility.

cu_log_binder_t cu_register_log_binder ( cu_log_binder_t  binder  ) 

Register a new log-binder. A log-binder will be called with all existing logs and logs created in the future. It's purpose is to assign a suitable vlogf implementation to log facilities based on the various meta-information stored in the facility. E.g. it may decide to direct error messages to a system log and to mail critical errors to an email account.

The vlogf function assigned by binder must be thread-safe.

void cu_register_permanent_log ( cu_log_facility_t  facility  ) 

Register a log facility which will persist throughout the life-time of the process. If cu_register_log_binder is called later, the new binder will process facility, allowing it to change the vlogf implementation.

void cu_register_transient_log ( cu_log_facility_t  facility  ) 

Register a transient logging facility. As opposed to cu_register_permanent_log, this facility will be passed only to the current log-binder, and not any future ones.

void cu_vlogf ( cu_log_facility_t  facility,
char const *  fmt,
va_list  va 
)

Run the vlogf implementation of facility.

void cu_vlogf_at ( cu_log_facility_t  facility,
cu_location_t  loc,
char const *  fmt,
va_list  va 
)

Run the vlogf implementation of facility with a source location.

Generated 2009-11-23 for culibs-0.25 using Doxygen. Maintained by Petter Urkedal.