From 0a63e3fa10d25273e5cc658c88a0dc54c93d4e7d Mon Sep 17 00:00:00 2001 From: Mark Michelson Date: Fri, 21 May 2010 15:15:58 +0000 Subject: Log spandsp's fax debug output to the FAX logger level. Review: https://reviewboard.asterisk.org/r/658 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@264953 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- res/res_fax.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'res/res_fax.c') diff --git a/res/res_fax.c b/res/res_fax.c index 04c426a0d..daccc7d0a 100644 --- a/res/res_fax.c +++ b/res/res_fax.c @@ -101,6 +101,8 @@ struct ast_fax_debug_info { struct ast_dsp *dsp; }; +static int fax_logger_level = -1; + /*! \brief maximum buckets for res_fax ao2 containers */ #define FAX_MAXBUCKETS 10 @@ -448,6 +450,15 @@ const char *ast_fax_state_to_str(enum ast_fax_state state) } } +void ast_fax_log(int level, const char *file, const int line, const char *function, const char *msg) +{ + if (fax_logger_level != -1) { + ast_log_dynamic_level(fax_logger_level, "%s", msg); + } else { + ast_log(level, file, line, function, "%s", msg); + } +} + /*! \brief convert a rate string to a rate */ static int fax_rate_str_to_int(const char *ratestr) { @@ -2195,6 +2206,10 @@ static int unload_module(void) ast_log(LOG_WARNING, "failed to unregister '%s'\n", app_receivefax); } + if (fax_logger_level != -1) { + ast_logger_unregister_level("FAX"); + } + ao2_ref(faxregistry.container, -1); return 0; @@ -2231,6 +2246,7 @@ static int load_module(void) } ast_cli_register_multiple(fax_cli, ARRAY_LEN(fax_cli)); res = ast_custom_function_register(&acf_faxopt); + fax_logger_level = ast_logger_register_level("FAX"); return res; } -- cgit v1.2.3