|
DTNMA Reference Tools v2.1.0 - 13.gc5c0bac
Delay-Tolerant Networking Management Architecture (DTNMA) Tool Suite
|
#include "cace/config.h"#include "logging.h"#include "defs.h"#include <m-buffer.h>#include <m-string.h>#include <m-atomic.h>#include <pthread.h>#include <stdarg.h>#include <stdio.h>#include <strings.h>#include <sys/time.h>#include <time.h>
Include dependency graph for logging_stderr.c:Data Structures | |
| struct | cace_log_event_t |
| A single event for the log. More... | |
Macros | |
| #define | BSL_LOG_QUEUE_SIZE 100 |
| Number of events to buffer to I/O thread. | |
| #define | M_OPL_cace_log_event_t() |
| OPLIST for cace_log_event_t. | |
Functions | |
| void | cace_log_event_init (cace_log_event_t *obj) |
| static void | cace_log_event_init_set (cace_log_event_t *obj, const cace_log_event_t *src) |
| static void | cace_log_event_init_move (cace_log_event_t *obj, cace_log_event_t *src) |
| static void | cace_log_event_set (cace_log_event_t *obj, const cace_log_event_t *src) |
| void | cace_log_event_deinit (cace_log_event_t *obj) |
| static void | write_log (const cace_log_event_t *event) |
| static void * | work_sink (void *arg) |
| void | cace_openlog (void) |
| Opens the event log. | |
| void | cace_closelog (void) |
| Closes the event log. | |
| int | cace_log_get_severity (int *severity, const char *name) |
| Interpret a text name as a severity level. | |
| void | cace_log_set_least_severity (int severity) |
| Set the least severity enabled for logging. | |
| bool | cace_log_is_enabled_for (int severity) |
| Determine if a particular severity is being logged. | |
| void | cace_log (int severity, const char *filename, int lineno, const char *funcname, const char *format,...) |
| Log an event. | |
Variables | |
| static const char * | sev_names [] |
| static atomic_int | least_severity = LOG_DEBUG |
| Shared least severity. | |
| static cace_log_queue_t | event_queue |
| Shared safe queue. | |
| static pthread_t | thr_sink |
| Sink thread ID. | |
| static atomic_bool | thr_valid = ATOMIC_VAR_INIT(false) |
| True if thr_sink is valid. | |
| static atomic_bool | did_crit = ATOMIC_VAR_INIT(false) |
| Log internal error once. | |
| #define BSL_LOG_QUEUE_SIZE 100 |
Number of events to buffer to I/O thread.
| #define M_OPL_cace_log_event_t | ( | ) |
OPLIST for cace_log_event_t.
| void cace_closelog | ( | void | ) |
Closes the event log.
This is a mimic to POSIX closelog()
References cace_log_event_deinit(), cace_log_event_init(), event_queue, cace_log_event_t::message, cace_log_event_t::severity, thr_sink, thr_valid, and write_log().
Referenced by main(), and suiteTearDown().
| void cace_log | ( | int | severity, |
| const char * | filename, | ||
| int | lineno, | ||
| const char * | funcname, | ||
| const char * | format, | ||
| ... | |||
| ) |
Log an event.
| severity | The severity from a subset of the POSIX syslog values. | |
| [in] | filename | The originating file name, which may include directory parts. |
| [in] | lineno | The originating file line number. |
| [in] | funcname | The originating function name. |
| [in] | format | The log message format string. |
| ... | Values for the format string. |
References cace_log_event_deinit(), cace_log_event_init(), cace_log_is_enabled_for(), cace_log_event_t::context, did_crit, event_queue, cace_log_event_t::message, cace_log_event_t::severity, thr_valid, va_end(), va_start(), and write_log().
| void cace_log_event_deinit | ( | cace_log_event_t * | obj | ) |
References cace_log_event_t::context, and cace_log_event_t::message.
Referenced by cace_closelog(), cace_log(), cace_openlog(), and work_sink().
| void cace_log_event_init | ( | cace_log_event_t * | obj | ) |
References cace_log_event_t::context, cace_log_event_t::message, cace_log_event_t::severity, cace_log_event_t::thread, and cace_log_event_t::timestamp.
Referenced by cace_closelog(), cace_log(), and cace_openlog().
|
static |
|
static |
|
static |
| int cace_log_get_severity | ( | int * | severity, |
| const char * | name | ||
| ) |
Interpret a text name as a severity level.
| [out] | severity | The associated severity level. |
| [in] | name | The text name, which is case insensitive. |
References CHKERR1, and sev_names.
Referenced by main(), and mgr_parse_args().
| bool cace_log_is_enabled_for | ( | int | severity | ) |
Determine if a particular severity is being logged.
This function is multi-thread safe.
| severity | The severity from a subset of the POSIX syslog values. |
References least_severity.
Referenced by agentParseHex(), cace_amm_actual_param_set_populate(), cace_amm_obj_ns_add_obj(), cace_amm_semtype_tblt_match(), cace_amm_semtype_union_convert(), cace_amp_msg_decode(), cace_amp_msg_encode(), cace_amp_proxy_cli_recv(), cace_amp_proxy_msg_recv(), cace_log(), refda_acl_search_endpoint(), refda_acl_search_permission(), refda_adm_ietf_dtnma_agent_ctrl_ensure_const(), refda_adm_ietf_dtnma_agent_ctrl_ensure_var(), refda_adm_ietf_dtnma_agent_ctrl_var_reset(), refda_adm_ietf_dtnma_agent_ctrl_var_store(), refda_binding_ident_bases(), refda_binding_semtype_use(), refda_ctrl_exec_ctx_check_result(), refda_edd_prod_check_result(), refda_eval_oper(), refda_eval_target(), refda_exec_proc_ctrl_finish(), refda_exec_proc_ctrl_start(), refda_exec_proc_expand(), refda_exec_worker_iteration(), refda_oper_eval_ctx_populate(), refda_reporting_gen(), refda_reporting_rptt_val(), refda_reporting_target(), refda_valprod_const_run(), refda_valprod_edd_run(), refda_valprod_run(), refda_valprod_var_run(), refdm_db_insert_execset(), refdm_db_insert_rptset(), refdm_ingress_worker(), and stdin_recv().
| void cace_log_set_least_severity | ( | int | severity | ) |
Set the least severity enabled for logging.
Other events will be dropped by the logging facility. This function is multi-thread safe.
| severity | The severity from a subset of the POSIX syslog values. |
References least_severity.
Referenced by LLVMFuzzerInitialize(), and main().
| void cace_openlog | ( | void | ) |
Opens the event log.
This is a mimic to POSIX openlog()
References BSL_LOG_QUEUE_SIZE, cace_log_event_deinit(), cace_log_event_init(), event_queue, cace_log_event_t::message, cace_log_event_t::severity, thr_sink, thr_valid, work_sink(), and write_log().
Referenced by LLVMFuzzerInitialize(), main(), and suiteSetUp().
|
static |
References cace_log_event_deinit(), event_queue, cace_log_event_t::message, running, and write_log().
Referenced by cace_openlog().
|
static |
References CHKVOID, and sev_names.
Referenced by cace_closelog(), cace_log(), cace_openlog(), and work_sink().
|
static |
Log internal error once.
Referenced by cace_log().
|
static |
Shared safe queue.
Referenced by cace_closelog(), cace_log(), cace_openlog(), and work_sink().
|
static |
Shared least severity.
Referenced by cace_log_is_enabled_for(), and cace_log_set_least_severity().
|
static |
Referenced by cace_log_get_severity(), and write_log().
|
static |
Sink thread ID.
Referenced by cace_closelog(), and cace_openlog().
|
static |
True if thr_sink is valid.
Referenced by cace_closelog(), cace_log(), and cace_openlog().