Asterisk - The Open Source Telephony Project GIT-master-f36a736
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 <sean@malleable.com>
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
21 *
22 * \brief Syslog support functions for Asterisk logging.
23 */
24
25#ifndef _ASTERISK_SYSLOG_H
26#define _ASTERISK_SYSLOG_H
27
28#if defined(__cplusplus) || defined(c_plusplus)
29extern "C" {
30#endif
31
32#define ASTNUMLOGLEVELS 32
33
34/*!
35 * \since 1.8
36 * \brief Maps a syslog facility name from a string to a syslog facility
37 * constant.
38 *
39 * \param facility Facility name to map (i.e. "daemon")
40 *
41 * \retval syslog facility constant (i.e. LOG_DAEMON) if found
42 * \retval -1 if facility is not found
43 */
44int ast_syslog_facility(const char *facility);
45
46/*!
47 * \since 1.8
48 * \brief Maps a syslog facility constant to a string.
49 *
50 * \param facility syslog facility constant to map (i.e. LOG_DAEMON)
51 *
52 * \retval facility name (i.e. "daemon") if found
53 * \retval NULL if facility is not found
54 */
55const char *ast_syslog_facility_name(int facility);
56
57/*!
58 * \since 1.8
59 * \brief Maps a syslog priority name from a string to a syslog priority
60 * constant.
61 *
62 * \param priority Priority name to map (i.e. "notice")
63 *
64 * \retval syslog priority constant (i.e. LOG_NOTICE) if found
65 * \retval -1 if priority is not found
66 */
67int ast_syslog_priority(const char *priority);
68
69/*!
70 * \since 1.8
71 * \brief Maps a syslog priority constant to a string.
72 *
73 * \param priority syslog priority constant to map (i.e. LOG_NOTICE)
74 *
75 * \retval priority name (i.e. "notice") if found
76 * \retval NULL if priority is not found
77 */
78const char *ast_syslog_priority_name(int priority);
79
80/*!
81 * \since 1.8
82 * \brief Maps an Asterisk log level (i.e. LOG_ERROR) to a syslog priority
83 * constant.
84 *
85 * \param level Asterisk log level constant (i.e. LOG_ERROR)
86 *
87 * \retval syslog priority constant (i.e. LOG_ERR) if found
88 * \retval -1 if priority is not found
89 */
91
92#if defined(__cplusplus) || defined(c_plusplus)
93}
94#endif
95
96#endif /* _ASTERISK_SYSLOG_H */
static int priority
const char * ast_syslog_facility_name(int facility)
Maps a syslog facility constant to a string.
Definition: syslog.c:98
int ast_syslog_priority(const char *priority)
Maps a syslog priority name from a string to a syslog priority constant.
Definition: syslog.c:126
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
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_priority_name(int priority)
Maps a syslog priority constant to a string.
Definition: syslog.c:139