00001 /* 00002 * Asterisk -- An open source telephony toolkit. 00003 * 00004 * Copyright (C) 2009, malleable, LLC. 00005 * 00006 * Sean Bright <sean@malleable.com> 00007 * 00008 * See http://www.asterisk.org for more information about 00009 * the Asterisk project. Please do not directly contact 00010 * any of the maintainers of this project for assistance; 00011 * the project provides a web site, mailing lists and IRC 00012 * channels for your use. 00013 * 00014 * This program is free software, distributed under the terms of 00015 * the GNU General Public License Version 2. See the LICENSE file 00016 * at the top of the source tree. 00017 */ 00018 00019 /*! 00020 * \file syslog.h 00021 * \brief Syslog support functions for Asterisk logging. 00022 */ 00023 00024 #ifndef _ASTERISK_SYSLOG_H 00025 #define _ASTERISK_SYSLOG_H 00026 00027 #if defined(__cplusplus) || defined(c_plusplus) 00028 extern "C" { 00029 #endif 00030 00031 /*! 00032 * \since 1.8 00033 * \brief Maps a syslog facility name from a string to a syslog facility 00034 * constant. 00035 * 00036 * \param facility Facility name to map (i.e. "daemon") 00037 * 00038 * \retval syslog facility constant (i.e. LOG_DAEMON) if found 00039 * \retval -1 if facility is not found 00040 */ 00041 int ast_syslog_facility(const char *facility); 00042 00043 /*! 00044 * \since 1.8 00045 * \brief Maps a syslog facility constant to a string. 00046 * 00047 * \param facility syslog facility constant to map (i.e. LOG_DAEMON) 00048 * 00049 * \retval facility name (i.e. "daemon") if found 00050 * \retval NULL if facility is not found 00051 */ 00052 const char *ast_syslog_facility_name(int facility); 00053 00054 /*! 00055 * \since 1.8 00056 * \brief Maps a syslog priority name from a string to a syslog priority 00057 * constant. 00058 * 00059 * \param priority Priority name to map (i.e. "notice") 00060 * 00061 * \retval syslog priority constant (i.e. LOG_NOTICE) if found 00062 * \retval -1 if priority is not found 00063 */ 00064 int ast_syslog_priority(const char *priority); 00065 00066 /*! 00067 * \since 1.8 00068 * \brief Maps a syslog priority constant to a string. 00069 * 00070 * \param priority syslog priority constant to map (i.e. LOG_NOTICE) 00071 * 00072 * \retval priority name (i.e. "notice") if found 00073 * \retval NULL if priority is not found 00074 */ 00075 const char *ast_syslog_priority_name(int priority); 00076 00077 /*! 00078 * \since 1.8 00079 * \brief Maps an Asterisk log level (i.e. LOG_ERROR) to a syslog priority 00080 * constant. 00081 * 00082 * \param level Asterisk log level constant (i.e. LOG_ERROR) 00083 * 00084 * \retval syslog priority constant (i.e. LOG_ERR) if found 00085 * \retval -1 if priority is not found 00086 */ 00087 int ast_syslog_priority_from_loglevel(int level); 00088 00089 #if defined(__cplusplus) || defined(c_plusplus) 00090 } 00091 #endif 00092 00093 #endif /* _ASTERISK_SYSLOG_H */