41 {
"local0", LOG_LOCAL0 },
42 {
"local1", LOG_LOCAL1 },
43 {
"local2", LOG_LOCAL2 },
44 {
"local3", LOG_LOCAL3 },
45 {
"local4", LOG_LOCAL4 },
46 {
"local5", LOG_LOCAL5 },
47 {
"local6", LOG_LOCAL6 },
48 {
"local7", LOG_LOCAL7 },
49 #if defined(HAVE_SYSLOG_FACILITY_LOG_KERN)
52 #if defined(HAVE_SYSLOG_FACILITY_LOG_MAIL)
55 #if defined(HAVE_SYSLOG_FACILITY_LOG_DAEMON)
56 {
"daemon", LOG_DAEMON },
58 #if defined(HAVE_SYSLOG_FACILITY_LOG_AUTH)
60 {
"security", LOG_AUTH },
62 #if defined(HAVE_SYSLOG_FACILITY_LOG_AUTHPRIV)
63 {
"authpriv", LOG_AUTHPRIV },
65 #if defined(HAVE_SYSLOG_FACILITY_LOG_SYSLOG)
66 {
"syslog", LOG_SYSLOG },
68 #if defined(HAVE_SYSLOG_FACILITY_LOG_FTP)
71 #if defined(HAVE_SYSLOG_FACILITY_LOG_LPR)
74 #if defined(HAVE_SYSLOG_FACILITY_LOG_NEWS)
77 #if defined(HAVE_SYSLOG_FACILITY_LOG_UUCP)
80 #if defined(HAVE_SYSLOG_FACILITY_LOG_CRON)
89 for (index = 0; index < ARRAY_LEN(facility_map); index++) {
90 if (!strcasecmp(facility_map[index].name, facility)) {
91 return facility_map[index].value;
102 for (index = 0; index < ARRAY_LEN(facility_map); index++) {
103 if (facility_map[index].value == facility) {
104 return facility_map[index].name;
111 static const struct {
115 {
"alert", LOG_ALERT },
116 {
"crit", LOG_CRIT },
117 {
"debug", LOG_DEBUG },
118 {
"emerg", LOG_EMERG },
120 {
"error", LOG_ERR },
121 {
"info", LOG_INFO },
122 {
"notice", LOG_NOTICE },
123 {
"warning", LOG_WARNING },
130 for (index = 0; index < ARRAY_LEN(priority_map); index++) {
131 if (!strcasecmp(priority_map[index].name, priority)) {
132 return priority_map[index].value;
143 for (index = 0; index < ARRAY_LEN(priority_map); index++) {
144 if (priority_map[index].value == priority) {
145 return priority_map[index].name;
152 static const int logger_level_to_syslog_map[] = {
153 [__LOG_DEBUG] = LOG_DEBUG,
155 [__LOG_NOTICE] = LOG_NOTICE,
156 [__LOG_WARNING] = LOG_WARNING,
157 [__LOG_ERROR] = LOG_ERR,
158 [__LOG_VERBOSE] = LOG_DEBUG,
159 [__LOG_DTMF] = LOG_DEBUG,
167 if (level >= 16 && level < ASTNUMLOGLEVELS) {
171 if (level < 0 || level >= ARRAY_LEN(logger_level_to_syslog_map)) {
175 return logger_level_to_syslog_map[level];
int ast_syslog_priority(const char *priority)
Maps a syslog priority name from a string to a syslog priority constant.
Asterisk main include file. File version handling, generic pbx functions.
const char * ast_syslog_facility_name(int facility)
Maps a syslog facility constant to a string.
int ast_syslog_priority_from_loglevel(int level)
Maps an Asterisk log level (i.e. LOG_ERROR) to a syslog priority constant.
int ast_syslog_facility(const char *facility)
Maps a syslog facility name from a string to a syslog facility constant.
Syslog support functions for Asterisk logging.
const char * ast_syslog_priority_name(int priority)
Maps a syslog priority constant to a string.