Defines | |
#define | lwl_get_log_file(h) lwl_get_default_log_file(h) |
Alias for lwl_get_default_log_file(). | |
Typedefs | |
typedef _lwl_handle * | lwlh_t |
LWL handle type. | |
Enumerations | |
enum | lwl_tag_t { LWL_TAG_DONE = 0, LWL_TAG_LEVEL, LWL_TAG_PREFIX, LWL_TAG_OPTIONS, LWL_TAG_FILE, LWL_TAG_FILE_EMERG, LWL_TAG_FILE_ALERT, LWL_TAG_FILE_CRIT, LWL_TAG_FILE_ERR, LWL_TAG_FILE_WARNING, LWL_TAG_FILE_NOTICE, LWL_TAG_FILE_INFO, LWL_TAG_FILE_DEBUG } |
LWL Tags. More... | |
enum | lwl_option_t { LWL_OPT_NONE = 0, LWL_OPT_PERROR = 1, LWL_OPT_PID = 2, LWL_OPT_DATE = 4, LWL_OPT_TIME = 8, LWL_OPT_IP = 16, LWL_OPT_ADR = 32, LWL_OPT_PRIORITY = 64, LWL_OPT_PREFIX = 128, LWL_OPT_NO_FLUSH = 256, LWL_OPT_USE_LOCALE = 512 } |
LWL options. More... | |
enum | lwl_priority_t { LWL_PRI_EMERG = 0, LWL_PRI_ALERT = 1, LWL_PRI_CRIT = 2, LWL_PRI_ERR = 3, LWL_PRI_WARNING = 4, LWL_PRI_NOTICE = 5, LWL_PRI_INFO = 6, LWL_PRI_DEBUG = 7 } |
LWL priority. More... | |
Functions | |
lwlh_t | lwl_alloc (void) |
Create a new LWL handle. | |
void | lwl_free (lwlh_t HANDLE) |
Destroy a LWL handle. | |
void | lwl_write_log (lwlh_t HANDLE, lwl_priority_t PRI, char *FORMAT,...) |
Log a message to the files associated to a LWL handle. | |
int | lwl_set_attributes (lwlh_t HANDLE, lwl_tag_t TAGS,...) |
Modify the attributes of a LWL handle. | |
lwl_priority_t | lwl_get_log_level (const lwlh_t HANDLE) |
Get the actual log level of a LWL handle. | |
FILE * | lwl_get_default_log_file (const lwlh_t HANDLE) |
Get the actual default file where a LWL handle is logging into. | |
const char * | lwl_get_hostname (lwlh_t HANDLE) |
Get the hostname of a LWL handle. |
|
Alias for lwl_get_default_log_file().
|
|
LWL handle type. This type is voluntary opaque. Variables of this kind could'nt be directly used, but by the functions of this module. |
|
LWL options. This is the list of available LWL options for use with lwl_set_attributes(). The options could be XOR-ed to use more than one option at the same time. Example: LWL_OPT_ADR | LWL_OPT_PID | LWL_OPT_DATE | LWL_OPT_TIME means you want to use all these options for each logged message.
|
|
LWL priority. This is the list of available LWL priorities for use with lwl_write_log()
|
|
LWL Tags. This is the list of available lwl_tag_t tags for use with lwl_set_attributes().
|
|
Create a new LWL handle. Allocate a new LWL handle data structure. The intial log file used is stdout and the initial level is LWL_PRI_DEBUG. To change them and other attributes, uses lwl_set_attributes() function. Default values are:
|
|
Destroy a LWL handle. Deallocate and destroy the lwl HANDLE.
|
|
Get the actual default file where a LWL handle is logging into.
|
|
Get the hostname of a LWL handle.
|
|
Get the actual log level of a LWL handle.
|
|
Modify the attributes of a LWL handle. To use this function, you must use LWL_TAGs to specify each tag you want to set. The list of tags is fully determinated by the lwl_tag_t type. Each tag must be followed by its new value, and the tag list must be terminated by LWL_TAG_DONE. If the tag list is not terminated by LWL_TAG_DONE the result of this function is not determined. Example: lwl_set_attributes (my_handle, LWL_TAG_PREFIX, "my example app", LWL_TAG_FILE, stderr, LWL_TAG_OPTIONS, LWL_OPT_PRIORITY | LWL_OPT_DATE, LWL_TAG_DONE);
|
|
Log a message to the files associated to a LWL handle. Write the given formated message of priority PRI to the HANDLE's files. To change the HANDLE's files, or log level, you can use lwl_set_attributes() function. If no files were specified by LWL_TAG_FILE_xxx tags, then all logs are written to the file specified by LWL_TAG_FILE (or to the default one if no LWL_TAG_FILE was specified). If a file was specified for a given level, by use of tags like LWL_TAG_FILE_xxx, then the specified file is used instead of the default one. The message FORMAT must be used like printf(). The message will be logged only if PRI is <= HANDLE's log level (wich you can consult with lwl_get_log_level()). Example: lwl_write_log (my_handle, LWL_PRI_DEBUG, "%s:%d-%s ERROR", __FILE__, __LINE__, __FUNCTION__);
|