[asterisk-commits] mmichelson: trunk r264953 - in /trunk: include/asterisk/ res/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri May 21 10:16:00 CDT 2010
Author: mmichelson
Date: Fri May 21 10:15:58 2010
New Revision: 264953
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=264953
Log:
Log spandsp's fax debug output to the FAX logger level.
Review: https://reviewboard.asterisk.org/r/658
Modified:
trunk/include/asterisk/res_fax.h
trunk/res/res_fax.c
trunk/res/res_fax.exports.in
trunk/res/res_fax_spandsp.c
Modified: trunk/include/asterisk/res_fax.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/res_fax.h?view=diff&rev=264953&r1=264952&r2=264953
==============================================================================
--- trunk/include/asterisk/res_fax.h (original)
+++ trunk/include/asterisk/res_fax.h Fri May 21 10:15:58 2010
@@ -256,4 +256,15 @@
/*! \brief convert an ast_fax_state to a string */
const char *ast_fax_state_to_str(enum ast_fax_state state);
+/*!
+ * \brief Log message at FAX or recommended level
+ *
+ * The first four parameters can be represented with Asterisk's
+ * LOG_* levels. In other words, this function may be called
+ * like
+ *
+ * ast_fax_log(LOG_DEBUG, msg);
+ */
+void ast_fax_log(int level, const char *file, const int line, const char *function, const char *msg);
+
#endif
Modified: trunk/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_fax.c?view=diff&rev=264953&r1=264952&r2=264953
==============================================================================
--- trunk/res/res_fax.c (original)
+++ trunk/res/res_fax.c Fri May 21 10:15:58 2010
@@ -101,6 +101,8 @@
struct ast_dsp *dsp;
};
+static int fax_logger_level = -1;
+
/*! \brief maximum buckets for res_fax ao2 containers */
#define FAX_MAXBUCKETS 10
@@ -445,6 +447,15 @@
default:
ast_log(LOG_WARNING, "unhandled FAX state: %d\n", state);
return "Unknown";
+ }
+}
+
+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);
}
}
@@ -2195,6 +2206,10 @@
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 @@
}
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;
}
Modified: trunk/res/res_fax.exports.in
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_fax.exports.in?view=diff&rev=264953&r1=264952&r2=264953
==============================================================================
--- trunk/res/res_fax.exports.in (original)
+++ trunk/res/res_fax.exports.in Fri May 21 10:15:58 2010
@@ -6,6 +6,7 @@
LINKER_SYMBOL_PREFIXast_fax_minrate;
LINKER_SYMBOL_PREFIXast_fax_maxrate;
LINKER_SYMBOL_PREFIXast_fax_state_to_str;
+ LINKER_SYMBOL_PREFIXast_fax_log;
local:
*;
};
Modified: trunk/res/res_fax_spandsp.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_fax_spandsp.c?view=diff&rev=264953&r1=264952&r2=264953
==============================================================================
--- trunk/res/res_fax_spandsp.c (original)
+++ trunk/res/res_fax_spandsp.c Fri May 21 10:15:58 2010
@@ -366,7 +366,7 @@
} else if (level == SPAN_LOG_WARNING) {
ast_log(LOG_WARNING, "%s", msg);
} else {
- ast_log(LOG_DEBUG, "%s", msg);
+ ast_fax_log(LOG_DEBUG, msg);
}
}
More information about the asterisk-commits
mailing list