00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #if !defined(_SPANDSP_LOGGING_H_)
00034 #define _SPANDSP_LOGGING_H_
00035
00036
00037 typedef void (*message_handler_func_t)(void *user_data, int level, const char *text);
00038
00039
00040 enum
00041 {
00042 SPAN_LOG_SEVERITY_MASK = 0x00FF,
00043 SPAN_LOG_SHOW_DATE = 0x0100,
00044 SPAN_LOG_SHOW_SAMPLE_TIME = 0x0200,
00045 SPAN_LOG_SHOW_SEVERITY = 0x0400,
00046 SPAN_LOG_SHOW_PROTOCOL = 0x0800,
00047 SPAN_LOG_SHOW_VARIANT = 0x1000,
00048 SPAN_LOG_SHOW_TAG = 0x2000,
00049 SPAN_LOG_SUPPRESS_LABELLING = 0x8000
00050 };
00051
00052
00053 enum
00054 {
00055 SPAN_LOG_NONE = 0,
00056 SPAN_LOG_ERROR = 1,
00057 SPAN_LOG_WARNING = 2,
00058 SPAN_LOG_PROTOCOL_ERROR = 3,
00059 SPAN_LOG_PROTOCOL_WARNING = 4,
00060 SPAN_LOG_FLOW = 5,
00061 SPAN_LOG_FLOW_2 = 6,
00062 SPAN_LOG_FLOW_3 = 7,
00063 SPAN_LOG_DEBUG = 8,
00064 SPAN_LOG_DEBUG_2 = 9,
00065 SPAN_LOG_DEBUG_3 = 10
00066 };
00067
00068
00069
00070
00071
00072 typedef struct logging_state_s logging_state_t;
00073
00074 #if defined(__cplusplus)
00075 extern "C"
00076 {
00077 #endif
00078
00079
00080
00081
00082
00083
00084
00085 SPAN_DECLARE(int) span_log_test(logging_state_t *s, int level);
00086
00087
00088
00089
00090
00091
00092
00093
00094 SPAN_DECLARE(int) span_log(logging_state_t *s, int level, const char *format, ...);
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105 SPAN_DECLARE(int) span_log_buf(logging_state_t *s, int level, const char *tag, const uint8_t *buf, int len);
00106
00107 SPAN_DECLARE(int) span_log_set_level(logging_state_t *s, int level);
00108
00109 SPAN_DECLARE(int) span_log_set_tag(logging_state_t *s, const char *tag);
00110
00111 SPAN_DECLARE(int) span_log_set_protocol(logging_state_t *s, const char *protocol);
00112
00113 SPAN_DECLARE(int) span_log_set_sample_rate(logging_state_t *s, int samples_per_second);
00114
00115 SPAN_DECLARE(int) span_log_bump_samples(logging_state_t *s, int samples);
00116
00117 SPAN_DECLARE(void) span_log_set_message_handler(logging_state_t *s, message_handler_func_t func, void *user_data);
00118
00119 SPAN_DECLARE(void) span_set_message_handler(message_handler_func_t func, void *user_data);
00120
00121 SPAN_DECLARE(logging_state_t *) span_log_init(logging_state_t *s, int level, const char *tag);
00122
00123 SPAN_DECLARE(int) span_log_release(logging_state_t *s);
00124
00125 SPAN_DECLARE(int) span_log_free(logging_state_t *s);
00126
00127 #if defined(__cplusplus)
00128 }
00129 #endif
00130
00131 #endif
00132