Asterisk - The Open Source Telephony Project  18.5.0
syslog.h
Go to the documentation of this file.
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2009, malleable, LLC.
5  *
6  * Sean Bright <[email protected]>
7  *
8  * See http://www.asterisk.org for more information about
9  * the Asterisk project. Please do not directly contact
10  * any of the maintainers of this project for assistance;
11  * the project provides a web site, mailing lists and IRC
12  * channels for your use.
13  *
14  * This program is free software, distributed under the terms of
15  * the GNU General Public License Version 2. See the LICENSE file
16  * at the top of the source tree.
17  */
18 
19 /*!
20  * \file syslog.h
21  * \brief Syslog support functions for Asterisk logging.
22  */
23 
24 #ifndef _ASTERISK_SYSLOG_H
25 #define _ASTERISK_SYSLOG_H
26 
27 #if defined(__cplusplus) || defined(c_plusplus)
28 extern "C" {
29 #endif
30 
31 #define ASTNUMLOGLEVELS 32
32 
33 /*!
34  * \since 1.8
35  * \brief Maps a syslog facility name from a string to a syslog facility
36  * constant.
37  *
38  * \param facility Facility name to map (i.e. "daemon")
39  *
40  * \retval syslog facility constant (i.e. LOG_DAEMON) if found
41  * \retval -1 if facility is not found
42  */
43 int ast_syslog_facility(const char *facility);
44 
45 /*!
46  * \since 1.8
47  * \brief Maps a syslog facility constant to a string.
48  *
49  * \param facility syslog facility constant to map (i.e. LOG_DAEMON)
50  *
51  * \retval facility name (i.e. "daemon") if found
52  * \retval NULL if facility is not found
53  */
54 const char *ast_syslog_facility_name(int facility);
55 
56 /*!
57  * \since 1.8
58  * \brief Maps a syslog priority name from a string to a syslog priority
59  * constant.
60  *
61  * \param priority Priority name to map (i.e. "notice")
62  *
63  * \retval syslog priority constant (i.e. LOG_NOTICE) if found
64  * \retval -1 if priority is not found
65  */
66 int ast_syslog_priority(const char *priority);
67 
68 /*!
69  * \since 1.8
70  * \brief Maps a syslog priority constant to a string.
71  *
72  * \param priority syslog priority constant to map (i.e. LOG_NOTICE)
73  *
74  * \retval priority name (i.e. "notice") if found
75  * \retval NULL if priority is not found
76  */
77 const char *ast_syslog_priority_name(int priority);
78 
79 /*!
80  * \since 1.8
81  * \brief Maps an Asterisk log level (i.e. LOG_ERROR) to a syslog priority
82  * constant.
83  *
84  * \param level Asterisk log level constant (i.e. LOG_ERROR)
85  *
86  * \retval syslog priority constant (i.e. LOG_ERR) if found
87  * \retval -1 if priority is not found
88  */
90 
91 #if defined(__cplusplus) || defined(c_plusplus)
92 }
93 #endif
94 
95 #endif /* _ASTERISK_SYSLOG_H */
int ast_syslog_priority(const char *priority)
Maps a syslog priority name from a string to a syslog priority constant.
Definition: syslog.c:126
const char * ast_syslog_priority_name(int priority)
Maps a syslog priority constant to a string.
Definition: syslog.c:139
int ast_syslog_priority_from_loglevel(int level)
Maps an Asterisk log level (i.e. LOG_ERROR) to a syslog priority constant.
Definition: syslog.c:162
static int priority
int ast_syslog_facility(const char *facility)
Maps a syslog facility name from a string to a syslog facility constant.
Definition: syslog.c:85
const char * ast_syslog_facility_name(int facility)
Maps a syslog facility constant to a string.
Definition: syslog.c:98