spandsp: logging.h File Reference

spandsp 0.0.6

Typedefs | Enumerations | Functions
logging.h File Reference

Go to the source code of this file.

## Typedefs
typedef void(* | message_handler_func_t) (int level, const char *text)
typedef void(* | error_handler_func_t) (const char *text)
typedef struct logging_state_s | logging_state_t

## Enumerations
enum | { SPAN_LOG_SEVERITY_MASK = 0x00FF , SPAN_LOG_SHOW_DATE = 0x0100 , SPAN_LOG_SHOW_SAMPLE_TIME = 0x0200 , SPAN_LOG_SHOW_SEVERITY = 0x0400 , SPAN_LOG_SHOW_PROTOCOL = 0x0800 , SPAN_LOG_SHOW_VARIANT = 0x1000 , SPAN_LOG_SHOW_TAG = 0x2000 , SPAN_LOG_SUPPRESS_LABELLING = 0x8000 }
enum | { SPAN_LOG_NONE = 0 , SPAN_LOG_ERROR = 1 , SPAN_LOG_WARNING = 2 , SPAN_LOG_PROTOCOL_ERROR = 3 , SPAN_LOG_PROTOCOL_WARNING = 4 , SPAN_LOG_FLOW = 5 , SPAN_LOG_FLOW_2 = 6 , SPAN_LOG_FLOW_3 = 7 , SPAN_LOG_DEBUG = 8 , SPAN_LOG_DEBUG_2 = 9 , SPAN_LOG_DEBUG_3 = 10 }

## Functions
int | 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_set_level (logging_state_t *s, int level)
int | span_log_set_tag (logging_state_t *s, const char *tag)
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 | span_log_set_error_handler (logging_state_t *s, error_handler_func_t func)
void | span_set_message_handler (message_handler_func_t func)
void | span_set_error_handler (error_handler_func_t func)
logging_state_t * | span_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)

## Typedef Documentation

## ◆ error_handler_func_t

typedef void(* error_handler_func_t) (const char *text)

Error logging function for spandsp logging.

## ◆ logging_state_t

typedef struct logging_state_s logging_state_t

Logging descriptor. This defines the working state for a single instance of the logging facility for spandsp.

## ◆ message_handler_func_t

typedef void(* message_handler_func_t) (int level, const char *text)

General logging function for spandsp logging.

## Function Documentation

## ◆ span_log()

int span_log | ( | logging_state_t * | s,
|  | int | level,
|  | const char * | format,
|  |  | ...
| ) |  |

Generate a log entry.

Generate a log entry.

Parameters

  s | The logging context.
  level | The severity level of the entry.
  format | ???

Returns
  0 if no output generated, else 1.

References span_log_test().

Referenced by dtmf_rx(), span_log_buf(), t30_decode_dis_dtc_dcs(), t30_front_end_status(), t30_non_ecm_get_byte(), t30_non_ecm_get_chunk(), t30_set_status(), t38_core_send_data(), t38_core_send_data_multi_field(), t38_core_send_indicator(), t38_non_ecm_buffer_report_input_status(), t38_non_ecm_buffer_report_output_status(), t4_rx_end_page(), t4_rx_init(), t4_rx_start_page(), t4_tx_init(), t4_tx_next_page_has_different_format(), t4_tx_start_page(), v17_rx_restart(), v22bis_request_retrain(), v27ter_rx_restart(), v29_tx_restart(), v42bis_decompress(), and v8_log_supported_modulations().

## ◆ 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

  s | The logging context.
  level | The severity level of the entry.
  tag | A label for the log entry.
  buf | The buffer to be dumped to the log.
  len | The length of buf.

Returns
  0 if no output generated, else 1.

References span_log(), and span_log_test().

## ◆ span_log_test()

int 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

  s | The logging context.
  level | The severity level to be tested.

Returns
  TRUE if logging is enable, else FALSE.

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