summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/asterisk/syslog.h2
-rw-r--r--main/syslog.c8
2 files changed, 10 insertions, 0 deletions
diff --git a/include/asterisk/syslog.h b/include/asterisk/syslog.h
index a0dc9e9cf..45d351a73 100644
--- a/include/asterisk/syslog.h
+++ b/include/asterisk/syslog.h
@@ -28,6 +28,8 @@
extern "C" {
#endif
+#define ASTNUMLOGLEVELS 32
+
/*!
* \since 1.8
* \brief Maps a syslog facility name from a string to a syslog facility
diff --git a/main/syslog.c b/main/syslog.c
index 9171be40b..51da69a8c 100644
--- a/main/syslog.c
+++ b/main/syslog.c
@@ -163,8 +163,16 @@ static const int logger_level_to_syslog_map[] = {
int ast_syslog_priority_from_loglevel(int level)
{
+ /* First 16 levels are reserved for system use.
+ * Default to using LOG_NOTICE for dynamic logging.
+ */
+ if (level >= 16 && level < ASTNUMLOGLEVELS) {
+ return LOG_NOTICE;
+ }
+
if (level < 0 || level >= ARRAY_LEN(logger_level_to_syslog_map)) {
return -1;
}
+
return logger_level_to_syslog_map[level];
}