spandsp 3.0.0
logging.c File Reference
#include <limits.h>
#include <stdio.h>
#include <stdarg.h>
#include <fcntl.h>
#include <stdlib.h>
#include <inttypes.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <sys/time.h>
#include "spandsp/stdbool.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/private/logging.h"

Functions

bool span_log_test (logging_state_t *s, int level)
 Test if logging of a specified severity level is enabled.
 
int span_log (logging_state_t *s, int level, const char *format,...)
 Generate a log entry.
 
int span_log_buf (logging_state_t *s, int level, const char *tag, const uint8_t *buf, int len)
 Generate a log entry displaying the contents of a buffer.
 
int span_log_get_level (logging_state_t *s)
 
int span_log_set_level (logging_state_t *s, int level)
 
const char * span_log_get_tag (logging_state_t *s)
 
int span_log_set_tag (logging_state_t *s, const char *tag)
 
const char * span_log_get_protocol (logging_state_t *s)
 
int span_log_set_protocol (logging_state_t *s, const char *protocol)
 
int span_log_set_sample_rate (logging_state_t *s, int samples_per_second)
 
int span_log_bump_samples (logging_state_t *s, int samples)
 
void span_log_set_message_handler (logging_state_t *s, message_handler_func_t func, void *user_data)
 
void span_set_message_handler (message_handler_func_t func, void *user_data)
 
logging_state_tspan_log_init (logging_state_t *s, int level, const char *tag)
 
int span_log_release (logging_state_t *s)
 
int span_log_free (logging_state_t *s)
 

Function Documentation

◆ span_log()

◆ span_log_buf()

int span_log_buf ( logging_state_t s,
int  level,
const char *  tag,
const uint8_t *  buf,
int  len 
)

Generate a log entry displaying the contents of a buffer.

Generate a log entry displaying the contents of a buffer.

Parameters
sThe logging context.
levelThe severity level of the entry.
tagA label for the log entry.
bufThe buffer to be dumped to the log.
lenThe length of buf.
Returns
0 if no output generated, else 1.

References span_log(), and span_log_test().

Referenced by t38_core_rx_ifp_stream(), and v8_rx().

◆ span_log_test()

bool span_log_test ( logging_state_t s,
int  level 
)

Test if logging of a specified severity level is enabled.

Test if logging of a specified severity level is enabled.

Parameters
sThe logging context.
levelThe severity level to be tested.
Returns
True if logging is enable.

Referenced by dtmf_rx(), span_log(), span_log_buf(), t30_decode_dis_dtc_dcs(), and t38_core_rx_ifp_stream().