⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 logging.h

📁 传真通信V27 V29 V17 T38解调与解码
💻 H
字号:
/* * SpanDSP - a series of DSP components for telephony * * logging.h - definitions for error and debug logging. * * Written by Steve Underwood <steveu@coppice.org> * * Copyright (C) 2005 Steve Underwood * * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: logging.h,v 1.13 2007/04/08 08:16:18 steveu Exp $ *//*! \file *//*! \page logging_page Logging\section logging_page_sec_1 What does it do????.*/#if !defined(_SPANDSP_LOGGING_H_)#define _SPANDSP_LOGGING_H_/*! General logging function for spandsp logging. */typedef void (*message_handler_func_t)(int level, const char *text);/*! Error logging function for spandsp logging. */typedef void (*error_handler_func_t)(const char *text);/* Logging elements */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};/* Logging severity levels */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};/*!    Logging descriptor. This defines the working state for a single instance of    the logging facility for spandsp.*/typedef struct{    int level;    int samples_per_second;    int64_t elapsed_samples;    const char *tag;    const char *protocol;    message_handler_func_t span_message;    error_handler_func_t span_error;} logging_state_t;#if defined(__cplusplus)extern "C"{#endif/*! Test if logging of a specified severity level is enabled.    \brief Test if logging of a specified severity level is enabled.    \param s The logging context.    \param level The severity level to be tested.    \return TRUE if logging is enable, else FALSE.*/int span_log_test(logging_state_t *s, int level);/*! Generate a log entry.    \brief Generate a log entry.    \param s The logging context.    \param level The severity level of the entry.    \param format ???    \return 0 if no output generated, else 1.*/int span_log(logging_state_t *s, int level, const char *format, ...);/*! Generate a log entry displaying the contents of a buffer.    \brief Generate a log entry displaying the contents of a buffer    \param s The logging context.    \param level The severity level of the entry.    \param tag A label for the log entry.    \param buf The buffer to be dumped to the log.    \param len The length of buf.    \return 0 if no output generated, else 1.*/int span_log_buf(logging_state_t *s, int level, const char *tag, const uint8_t *buf, int len);int span_log_init(logging_state_t *s, int level, const char *tag);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);#if defined(__cplusplus)}#endif#endif/*- End of file ------------------------------------------------------------*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -