[asterisk-commits] seanbright: branch seanbright/cdr-syslog r203598 - in /team/seanbright/cdr-sy...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jun 25 23:53:41 CDT 2009
Author: seanbright
Date: Thu Jun 25 23:53:37 2009
New Revision: 203598
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=203598
Log:
Merged revisions 203569 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r203569 | seanbright | 2009-06-25 23:06:06 -0400 (Thu, 25 Jun 2009) | 2 lines
Add checks in configure for non-POSIX syslog facilities.
........
Modified:
team/seanbright/cdr-syslog/ (props changed)
team/seanbright/cdr-syslog/configure
team/seanbright/cdr-syslog/configure.ac
team/seanbright/cdr-syslog/include/asterisk/autoconfig.h.in
team/seanbright/cdr-syslog/main/syslog.c
Propchange: team/seanbright/cdr-syslog/
------------------------------------------------------------------------------
automerge = *
Propchange: team/seanbright/cdr-syslog/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jun 25 23:53:37 2009
@@ -1,1 +1,1 @@
-/trunk:1-203535
+/trunk:1-203597
Modified: team/seanbright/cdr-syslog/configure.ac
URL: http://svn.asterisk.org/svn-view/asterisk/team/seanbright/cdr-syslog/configure.ac?view=diff&rev=203598&r1=203597&r2=203598
==============================================================================
--- team/seanbright/cdr-syslog/configure.ac (original)
+++ team/seanbright/cdr-syslog/configure.ac Thu Jun 25 23:53:37 2009
@@ -1757,30 +1757,11 @@
AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_DAEMON], [LOG_DAEMON], [syslog.h])
AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_FTP], [LOG_FTP], [syslog.h])
AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_KERN], [LOG_KERN], [syslog.h])
- AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_LOCAL0], [LOG_LOCAL0], [syslog.h])
- AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_LOCAL1], [LOG_LOCAL1], [syslog.h])
- AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_LOCAL2], [LOG_LOCAL2], [syslog.h])
- AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_LOCAL3], [LOG_LOCAL3], [syslog.h])
- AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_LOCAL4], [LOG_LOCAL4], [syslog.h])
- AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_LOCAL5], [LOG_LOCAL5], [syslog.h])
- AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_LOCAL6], [LOG_LOCAL6], [syslog.h])
- AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_LOCAL7], [LOG_LOCAL7], [syslog.h])
AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_LPR], [LOG_LPR], [syslog.h])
AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_MAIL], [LOG_MAIL], [syslog.h])
AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_NEWS], [LOG_NEWS], [syslog.h])
AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_SYSLOG], [LOG_SYSLOG], [syslog.h])
- AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_USER], [LOG_USER], [syslog.h])
AST_C_DEFINE_CHECK([SYSLOG_FACILITY_LOG_UUCP], [LOG_UUCP], [syslog.h])
-
- # syslog levels
- AST_C_DEFINE_CHECK([SYSLOG_LEVEL_LOG_EMERG], [LOG_EMERG], [syslog.h])
- AST_C_DEFINE_CHECK([SYSLOG_LEVEL_LOG_ALERT], [LOG_ALERT], [syslog.h])
- AST_C_DEFINE_CHECK([SYSLOG_LEVEL_LOG_CRIT], [LOG_CRIT], [syslog.h])
- AST_C_DEFINE_CHECK([SYSLOG_LEVEL_LOG_ERR], [LOG_ERR], [syslog.h])
- AST_C_DEFINE_CHECK([SYSLOG_LEVEL_LOG_WARNING], [LOG_WARNING], [syslog.h])
- AST_C_DEFINE_CHECK([SYSLOG_LEVEL_LOG_NOTICE], [LOG_NOTICE], [syslog.h])
- AST_C_DEFINE_CHECK([SYSLOG_LEVEL_LOG_INFO], [LOG_INFO], [syslog.h])
- AST_C_DEFINE_CHECK([SYSLOG_LEVEL_LOG_DEBUG], [LOG_DEBUG], [syslog.h])
PBX_SYSLOG=1
fi
Modified: team/seanbright/cdr-syslog/include/asterisk/autoconfig.h.in
URL: http://svn.asterisk.org/svn-view/asterisk/team/seanbright/cdr-syslog/include/asterisk/autoconfig.h.in?view=diff&rev=203598&r1=203597&r2=203598
==============================================================================
--- team/seanbright/cdr-syslog/include/asterisk/autoconfig.h.in (original)
+++ team/seanbright/cdr-syslog/include/asterisk/autoconfig.h.in Thu Jun 25 23:53:37 2009
@@ -1042,54 +1042,6 @@
/* Define SYSLOG_FACILITY_LOG_KERN headers version */
#undef HAVE_SYSLOG_FACILITY_LOG_KERN_VERSION
-/* Define if your system has the SYSLOG_FACILITY_LOG_LOCAL0 headers. */
-#undef HAVE_SYSLOG_FACILITY_LOG_LOCAL0
-
-/* Define SYSLOG_FACILITY_LOG_LOCAL0 headers version */
-#undef HAVE_SYSLOG_FACILITY_LOG_LOCAL0_VERSION
-
-/* Define if your system has the SYSLOG_FACILITY_LOG_LOCAL1 headers. */
-#undef HAVE_SYSLOG_FACILITY_LOG_LOCAL1
-
-/* Define SYSLOG_FACILITY_LOG_LOCAL1 headers version */
-#undef HAVE_SYSLOG_FACILITY_LOG_LOCAL1_VERSION
-
-/* Define if your system has the SYSLOG_FACILITY_LOG_LOCAL2 headers. */
-#undef HAVE_SYSLOG_FACILITY_LOG_LOCAL2
-
-/* Define SYSLOG_FACILITY_LOG_LOCAL2 headers version */
-#undef HAVE_SYSLOG_FACILITY_LOG_LOCAL2_VERSION
-
-/* Define if your system has the SYSLOG_FACILITY_LOG_LOCAL3 headers. */
-#undef HAVE_SYSLOG_FACILITY_LOG_LOCAL3
-
-/* Define SYSLOG_FACILITY_LOG_LOCAL3 headers version */
-#undef HAVE_SYSLOG_FACILITY_LOG_LOCAL3_VERSION
-
-/* Define if your system has the SYSLOG_FACILITY_LOG_LOCAL4 headers. */
-#undef HAVE_SYSLOG_FACILITY_LOG_LOCAL4
-
-/* Define SYSLOG_FACILITY_LOG_LOCAL4 headers version */
-#undef HAVE_SYSLOG_FACILITY_LOG_LOCAL4_VERSION
-
-/* Define if your system has the SYSLOG_FACILITY_LOG_LOCAL5 headers. */
-#undef HAVE_SYSLOG_FACILITY_LOG_LOCAL5
-
-/* Define SYSLOG_FACILITY_LOG_LOCAL5 headers version */
-#undef HAVE_SYSLOG_FACILITY_LOG_LOCAL5_VERSION
-
-/* Define if your system has the SYSLOG_FACILITY_LOG_LOCAL6 headers. */
-#undef HAVE_SYSLOG_FACILITY_LOG_LOCAL6
-
-/* Define SYSLOG_FACILITY_LOG_LOCAL6 headers version */
-#undef HAVE_SYSLOG_FACILITY_LOG_LOCAL6_VERSION
-
-/* Define if your system has the SYSLOG_FACILITY_LOG_LOCAL7 headers. */
-#undef HAVE_SYSLOG_FACILITY_LOG_LOCAL7
-
-/* Define SYSLOG_FACILITY_LOG_LOCAL7 headers version */
-#undef HAVE_SYSLOG_FACILITY_LOG_LOCAL7_VERSION
-
/* Define if your system has the SYSLOG_FACILITY_LOG_LPR headers. */
#undef HAVE_SYSLOG_FACILITY_LOG_LPR
@@ -1114,12 +1066,6 @@
/* Define SYSLOG_FACILITY_LOG_SYSLOG headers version */
#undef HAVE_SYSLOG_FACILITY_LOG_SYSLOG_VERSION
-/* Define if your system has the SYSLOG_FACILITY_LOG_USER headers. */
-#undef HAVE_SYSLOG_FACILITY_LOG_USER
-
-/* Define SYSLOG_FACILITY_LOG_USER headers version */
-#undef HAVE_SYSLOG_FACILITY_LOG_USER_VERSION
-
/* Define if your system has the SYSLOG_FACILITY_LOG_UUCP headers. */
#undef HAVE_SYSLOG_FACILITY_LOG_UUCP
@@ -1128,54 +1074,6 @@
/* Define to 1 if you have the <syslog.h> header file. */
#undef HAVE_SYSLOG_H
-
-/* Define if your system has the SYSLOG_LEVEL_LOG_ALERT headers. */
-#undef HAVE_SYSLOG_LEVEL_LOG_ALERT
-
-/* Define SYSLOG_LEVEL_LOG_ALERT headers version */
-#undef HAVE_SYSLOG_LEVEL_LOG_ALERT_VERSION
-
-/* Define if your system has the SYSLOG_LEVEL_LOG_CRIT headers. */
-#undef HAVE_SYSLOG_LEVEL_LOG_CRIT
-
-/* Define SYSLOG_LEVEL_LOG_CRIT headers version */
-#undef HAVE_SYSLOG_LEVEL_LOG_CRIT_VERSION
-
-/* Define if your system has the SYSLOG_LEVEL_LOG_DEBUG headers. */
-#undef HAVE_SYSLOG_LEVEL_LOG_DEBUG
-
-/* Define SYSLOG_LEVEL_LOG_DEBUG headers version */
-#undef HAVE_SYSLOG_LEVEL_LOG_DEBUG_VERSION
-
-/* Define if your system has the SYSLOG_LEVEL_LOG_EMERG headers. */
-#undef HAVE_SYSLOG_LEVEL_LOG_EMERG
-
-/* Define SYSLOG_LEVEL_LOG_EMERG headers version */
-#undef HAVE_SYSLOG_LEVEL_LOG_EMERG_VERSION
-
-/* Define if your system has the SYSLOG_LEVEL_LOG_ERR headers. */
-#undef HAVE_SYSLOG_LEVEL_LOG_ERR
-
-/* Define SYSLOG_LEVEL_LOG_ERR headers version */
-#undef HAVE_SYSLOG_LEVEL_LOG_ERR_VERSION
-
-/* Define if your system has the SYSLOG_LEVEL_LOG_INFO headers. */
-#undef HAVE_SYSLOG_LEVEL_LOG_INFO
-
-/* Define SYSLOG_LEVEL_LOG_INFO headers version */
-#undef HAVE_SYSLOG_LEVEL_LOG_INFO_VERSION
-
-/* Define if your system has the SYSLOG_LEVEL_LOG_NOTICE headers. */
-#undef HAVE_SYSLOG_LEVEL_LOG_NOTICE
-
-/* Define SYSLOG_LEVEL_LOG_NOTICE headers version */
-#undef HAVE_SYSLOG_LEVEL_LOG_NOTICE_VERSION
-
-/* Define if your system has the SYSLOG_LEVEL_LOG_WARNING headers. */
-#undef HAVE_SYSLOG_LEVEL_LOG_WARNING
-
-/* Define SYSLOG_LEVEL_LOG_WARNING headers version */
-#undef HAVE_SYSLOG_LEVEL_LOG_WARNING_VERSION
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
Modified: team/seanbright/cdr-syslog/main/syslog.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/seanbright/cdr-syslog/main/syslog.c?view=diff&rev=203598&r1=203597&r2=203598
==============================================================================
--- team/seanbright/cdr-syslog/main/syslog.c (original)
+++ team/seanbright/cdr-syslog/main/syslog.c Thu Jun 25 23:53:37 2009
@@ -30,73 +30,92 @@
#include <syslog.h>
+static const struct {
+ const char *name;
+ int value;
+} facility_map[] = {
+ /* POSIX only specifies USER and LOCAL0 - LOCAL7 */
+ { "USER", LOG_USER },
+ { "LOCAL0", LOG_LOCAL0 },
+ { "LOCAL1", LOG_LOCAL1 },
+ { "LOCAL2", LOG_LOCAL2 },
+ { "LOCAL3", LOG_LOCAL3 },
+ { "LOCAL4", LOG_LOCAL4 },
+ { "LOCAL5", LOG_LOCAL5 },
+ { "LOCAL6", LOG_LOCAL6 },
+ { "LOCAL7", LOG_LOCAL7 },
+#if defined(HAVE_SYSLOG_FACILITY_LOG_KERN)
+ { "KERN", LOG_KERN },
+#endif
+#if defined(HAVE_SYSLOG_FACILITY_LOG_MAIL)
+ { "MAIL", LOG_MAIL },
+#endif
+#if defined(HAVE_SYSLOG_FACILITY_LOG_DAEMON)
+ { "DAEMON", LOG_DAEMON },
+#endif
+#if defined(HAVE_SYSLOG_FACILITY_LOG_AUTH)
+ { "AUTH", LOG_AUTH },
+ { "SECURITY", LOG_AUTH },
+#endif
+#if defined(HAVE_SYSLOG_FACILITY_LOG_AUTHPRIV)
+ { "AUTHPRIV", LOG_AUTHPRIV },
+#endif
+#if defined(HAVE_SYSLOG_FACILITY_LOG_SYSLOG)
+ { "SYSLOG", LOG_SYSLOG },
+#endif
+#if defined(HAVE_SYSLOG_FACILITY_LOG_FTP)
+ { "FTP", LOG_FTP },
+#endif
+#if defined(HAVE_SYSLOG_FACILITY_LOG_LPR)
+ { "LPR", LOG_LPR },
+#endif
+#if defined(HAVE_SYSLOG_FACILITY_LOG_NEWS)
+ { "NEWS", LOG_NEWS },
+#endif
+#if defined(HAVE_SYSLOG_FACILITY_LOG_UUCP)
+ { "UUCP", LOG_UUCP },
+#endif
+#if defined(HAVE_SYSLOG_FACILITY_LOG_CRON)
+ { "CRON", LOG_CRON },
+#endif
+};
+
int ast_syslog_facility(const char *facility)
{
- if (!strcasecmp(facility, "KERN")) {
- return LOG_KERN;
- } else if (!strcasecmp(facility, "USER")) {
- return LOG_USER;
- } else if (!strcasecmp(facility, "MAIL")) {
- return LOG_MAIL;
- } else if (!strcasecmp(facility, "DAEMON")) {
- return LOG_DAEMON;
- } else if (!strcasecmp(facility, "AUTH")) {
- return LOG_AUTH;
- } else if (!strcasecmp(facility, "AUTHPRIV")) {
- return LOG_AUTHPRIV;
- } else if (!strcasecmp(facility, "SYSLOG")) {
- return LOG_SYSLOG;
- } else if (!strcasecmp(facility, "SECURITY")) {
- return LOG_AUTH;
- } else if (!strcasecmp(facility, "FTP")) {
- return LOG_FTP;
- } else if (!strcasecmp(facility, "LPR")) {
- return LOG_LPR;
- } else if (!strcasecmp(facility, "NEWS")) {
- return LOG_NEWS;
- } else if (!strcasecmp(facility, "UUCP")) {
- return LOG_UUCP;
- } else if (!strcasecmp(facility, "CRON")) {
- return LOG_CRON;
- } else if (!strcasecmp(facility, "LOCAL0")) {
- return LOG_LOCAL0;
- } else if (!strcasecmp(facility, "LOCAL1")) {
- return LOG_LOCAL1;
- } else if (!strcasecmp(facility, "LOCAL2")) {
- return LOG_LOCAL2;
- } else if (!strcasecmp(facility, "LOCAL3")) {
- return LOG_LOCAL3;
- } else if (!strcasecmp(facility, "LOCAL4")) {
- return LOG_LOCAL4;
- } else if (!strcasecmp(facility, "LOCAL5")) {
- return LOG_LOCAL5;
- } else if (!strcasecmp(facility, "LOCAL6")) {
- return LOG_LOCAL6;
- } else if (!strcasecmp(facility, "LOCAL7")) {
- return LOG_LOCAL7;
+ int index;
+
+ for (index = 0; index < ARRAY_LEN(facility_map); index++) {
+ if (!strcasecmp(facility_map[index].name, facility)) {
+ return facility_map[index].value;
+ }
}
return -1;
}
+static const struct {
+ const char *name;
+ int value;
+} priority_map[] = {
+ { "ALERT", LOG_ALERT },
+ { "CRIT", LOG_CRIT },
+ { "DEBUG", LOG_DEBUG },
+ { "EMERG", LOG_EMERG },
+ { "ERR", LOG_ERR },
+ { "ERROR", LOG_ERR },
+ { "INFO", LOG_INFO },
+ { "NOTICE", LOG_NOTICE },
+ { "WARNING", LOG_WARNING }
+};
+
int ast_syslog_priority(const char *priority)
{
- if (!strcasecmp(priority, "ALERT")) {
- return LOG_ALERT;
- } else if (!strcasecmp(priority, "CRIT")) {
- return LOG_CRIT;
- } else if (!strcasecmp(priority, "DEBUG")) {
- return LOG_DEBUG;
- } else if (!strcasecmp(priority, "EMERG")) {
- return LOG_EMERG;
- } else if (!strcasecmp(priority, "ERR")) {
- return LOG_ERR;
- } else if (!strcasecmp(priority, "INFO")) {
- return LOG_INFO;
- } else if (!strcasecmp(priority, "NOTICE")) {
- return LOG_NOTICE;
- } else if (!strcasecmp(priority, "WARNING")) {
- return LOG_WARNING;
+ int index;
+
+ for (index = 0; index < ARRAY_LEN(priority_map); index++) {
+ if (!strcasecmp(priority_map[index].name, priority)) {
+ return priority_map[index].value;
+ }
}
return -1;
More information about the asterisk-commits
mailing list