Go to the source code of this file.
Functions | |
int | ast_syslog_facility (const char *facility) |
Maps a syslog facility name from a string to a syslog facility constant. | |
const char * | ast_syslog_facility_name (int facility) |
Maps a syslog facility constant to a string. | |
int | ast_syslog_priority (const char *priority) |
Maps a syslog priority name from a string to a syslog priority constant. | |
int | ast_syslog_priority_from_loglevel (int level) |
Maps an Asterisk log level (i.e. LOG_ERROR) to a syslog priority constant. | |
const char * | ast_syslog_priority_name (int priority) |
Maps a syslog priority constant to a string. |
Definition in file syslog.h.
int ast_syslog_facility | ( | const char * | facility | ) |
Maps a syslog facility name from a string to a syslog facility constant.
facility | Facility name to map (i.e. "daemon") |
syslog | facility constant (i.e. LOG_DAEMON) if found | |
-1 | if facility is not found |
Definition at line 87 of file syslog.c.
References ARRAY_LEN, facility_map, and name.
Referenced by load_config(), and make_logchannel().
00088 { 00089 int index; 00090 00091 for (index = 0; index < ARRAY_LEN(facility_map); index++) { 00092 if (!strcasecmp(facility_map[index].name, facility)) { 00093 return facility_map[index].value; 00094 } 00095 } 00096 00097 return -1; 00098 }
const char* ast_syslog_facility_name | ( | int | facility | ) |
Maps a syslog facility constant to a string.
facility | syslog facility constant to map (i.e. LOG_DAEMON) |
facility | name (i.e. "daemon") if found | |
NULL | if facility is not found |
Definition at line 100 of file syslog.c.
References ARRAY_LEN, facility_map, and value.
Referenced by load_config().
00101 { 00102 int index; 00103 00104 for (index = 0; index < ARRAY_LEN(facility_map); index++) { 00105 if (facility_map[index].value == facility) { 00106 return facility_map[index].name; 00107 } 00108 } 00109 00110 return NULL; 00111 }
int ast_syslog_priority | ( | const char * | priority | ) |
Maps a syslog priority name from a string to a syslog priority constant.
priority | Priority name to map (i.e. "notice") |
syslog | priority constant (i.e. LOG_NOTICE) if found | |
-1 | if priority is not found |
Definition at line 128 of file syslog.c.
References ARRAY_LEN, name, and priority_map.
Referenced by load_config().
00129 { 00130 int index; 00131 00132 for (index = 0; index < ARRAY_LEN(priority_map); index++) { 00133 if (!strcasecmp(priority_map[index].name, priority)) { 00134 return priority_map[index].value; 00135 } 00136 } 00137 00138 return -1; 00139 }
int ast_syslog_priority_from_loglevel | ( | int | level | ) |
Maps an Asterisk log level (i.e. LOG_ERROR) to a syslog priority constant.
level | Asterisk log level constant (i.e. LOG_ERROR) |
syslog | priority constant (i.e. LOG_ERR) if found | |
-1 | if priority is not found |
Definition at line 164 of file syslog.c.
References ARRAY_LEN.
Referenced by ast_log_vsyslog().
00165 { 00166 if (level < 0 || level >= ARRAY_LEN(logger_level_to_syslog_map)) { 00167 return -1; 00168 } 00169 return logger_level_to_syslog_map[level]; 00170 }
const char* ast_syslog_priority_name | ( | int | priority | ) |
Maps a syslog priority constant to a string.
priority | syslog priority constant to map (i.e. LOG_NOTICE) |
priority | name (i.e. "notice") if found | |
NULL | if priority is not found |
Definition at line 141 of file syslog.c.
References ARRAY_LEN, priority_map, and value.
Referenced by load_config().
00142 { 00143 int index; 00144 00145 for (index = 0; index < ARRAY_LEN(priority_map); index++) { 00146 if (priority_map[index].value == priority) { 00147 return priority_map[index].name; 00148 } 00149 } 00150 00151 return NULL; 00152 }