syslog.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. * \file syslog.h
  20. * \brief Syslog support functions for Asterisk logging.
  21. */
  22. #ifndef _ASTERISK_SYSLOG_H
  23. #define _ASTERISK_SYSLOG_H
  24. #if defined(__cplusplus) || defined(c_plusplus)
  25. extern "C" {
  26. #endif
  27. #define ASTNUMLOGLEVELS 32
  28. /*!
  29. * \since 1.8
  30. * \brief Maps a syslog facility name from a string to a syslog facility
  31. * constant.
  32. *
  33. * \param facility Facility name to map (i.e. "daemon")
  34. *
  35. * \retval syslog facility constant (i.e. LOG_DAEMON) if found
  36. * \retval -1 if facility is not found
  37. */
  38. int ast_syslog_facility(const char *facility);
  39. /*!
  40. * \since 1.8
  41. * \brief Maps a syslog facility constant to a string.
  42. *
  43. * \param facility syslog facility constant to map (i.e. LOG_DAEMON)
  44. *
  45. * \retval facility name (i.e. "daemon") if found
  46. * \retval NULL if facility is not found
  47. */
  48. const char *ast_syslog_facility_name(int facility);
  49. /*!
  50. * \since 1.8
  51. * \brief Maps a syslog priority name from a string to a syslog priority
  52. * constant.
  53. *
  54. * \param priority Priority name to map (i.e. "notice")
  55. *
  56. * \retval syslog priority constant (i.e. LOG_NOTICE) if found
  57. * \retval -1 if priority is not found
  58. */
  59. int ast_syslog_priority(const char *priority);
  60. /*!
  61. * \since 1.8
  62. * \brief Maps a syslog priority constant to a string.
  63. *
  64. * \param priority syslog priority constant to map (i.e. LOG_NOTICE)
  65. *
  66. * \retval priority name (i.e. "notice") if found
  67. * \retval NULL if priority is not found
  68. */
  69. const char *ast_syslog_priority_name(int priority);
  70. /*!
  71. * \since 1.8
  72. * \brief Maps an Asterisk log level (i.e. LOG_ERROR) to a syslog priority
  73. * constant.
  74. *
  75. * \param level Asterisk log level constant (i.e. LOG_ERROR)
  76. *
  77. * \retval syslog priority constant (i.e. LOG_ERR) if found
  78. * \retval -1 if priority is not found
  79. */
  80. int ast_syslog_priority_from_loglevel(int level);
  81. #if defined(__cplusplus) || defined(c_plusplus)
  82. }
  83. #endif
  84. #endif /* _ASTERISK_SYSLOG_H */