1999-10-27 00:56:38 +00:00
|
|
|
/*
|
2005-08-30 18:32:10 +00:00
|
|
|
* Asterisk -- An open source telephony toolkit.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1999 - 2005, Digium, Inc.
|
1999-10-27 00:56:38 +00:00
|
|
|
*
|
2005-08-30 18:32:10 +00:00
|
|
|
* Mark Spencer <markster@digium.com>
|
1999-10-27 00:56:38 +00:00
|
|
|
*
|
2005-08-30 18:32:10 +00:00
|
|
|
* See http://www.asterisk.org for more information about
|
|
|
|
* the Asterisk project. Please do not directly contact
|
|
|
|
* any of the maintainers of this project for assistance;
|
|
|
|
* the project provides a web site, mailing lists and IRC
|
|
|
|
* channels for your use.
|
1999-10-27 00:56:38 +00:00
|
|
|
*
|
2005-08-30 18:32:10 +00:00
|
|
|
* This program is free software, distributed under the terms of
|
|
|
|
* the GNU General Public License Version 2. See the LICENSE file
|
|
|
|
* at the top of the source tree.
|
1999-10-27 00:56:38 +00:00
|
|
|
*/
|
2005-08-30 18:32:10 +00:00
|
|
|
|
2005-08-25 23:21:01 +00:00
|
|
|
/*!
|
|
|
|
\file logger.h
|
|
|
|
\brief Support for logging to various files, console and syslog
|
|
|
|
Configuration in file logger.conf
|
|
|
|
*/
|
1999-10-27 00:56:38 +00:00
|
|
|
|
2005-08-30 18:32:10 +00:00
|
|
|
#ifndef _ASTERISK_LOGGER_H
|
|
|
|
#define _ASTERISK_LOGGER_H
|
|
|
|
|
2007-11-19 14:36:12 +00:00
|
|
|
#include "asterisk/options.h" /* need option_debug */
|
|
|
|
|
1999-10-27 00:56:38 +00:00
|
|
|
#if defined(__cplusplus) || defined(c_plusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define EVENTLOG "event_log"
|
2006-02-26 16:40:39 +00:00
|
|
|
#define QUEUELOG "queue_log"
|
1999-10-27 00:56:38 +00:00
|
|
|
|
|
|
|
#define DEBUG_M(a) { \
|
|
|
|
a; \
|
|
|
|
}
|
|
|
|
|
2005-12-04 20:40:46 +00:00
|
|
|
#define VERBOSE_PREFIX_1 " "
|
|
|
|
#define VERBOSE_PREFIX_2 " == "
|
|
|
|
#define VERBOSE_PREFIX_3 " -- "
|
2006-03-31 10:35:25 +00:00
|
|
|
#define VERBOSE_PREFIX_4 " > "
|
2005-12-04 20:40:46 +00:00
|
|
|
|
2007-12-11 14:17:29 +00:00
|
|
|
/*! \brief Used for sending a log message
|
|
|
|
This is the standard logger function. Probably the only way you will invoke it would be something like this:
|
Round 2 of IMAP_STORAGE app_voicemail.c fixes:
This fixes a bug that was thought to be fixed already.
app_voicemail, if using IMAP_STORAGE, has a problem because
the IMAP header files include syslog.h, which define LOG_WARNING
and LOG_DEBUG to be different than what Asterisk uses for those
same macros. This was "fixed" in the past by including all the
IMAP header files prior to including asterisk.h. This fix worked...
unless you were to try to compile with MALLOC_DEBUG. MALLOC_DEBUG
prepends the inclusion of astmm.h to every file, which means that no
matter what order the includes are in in app_voicemail, the unexpected
values for LOG_WARNING and LOG_DEBUG will be in place.
The action taken for this fix was to define AST_LOG_* macros in addition
to the LOG_* macros already defined. These new macros are used in app_voicemail.c,
logger.h, and astobj.h right now, and their use will be encouraged in the future.
In consideration of those who have written third-party modules which use
the LOG_* macros, these will NOT be removed from the source, however future use
of these macros is discouraged.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114577 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-23 00:58:49 +00:00
|
|
|
ast_log(AST_LOG_WHATEVER, "Problem with the %s Captain. We should get some more. Will %d be enough?\n", "flux capacitor", 10);
|
2005-08-25 23:21:01 +00:00
|
|
|
where WHATEVER is one of ERROR, DEBUG, EVENT, NOTICE, or WARNING depending
|
|
|
|
on which log you wish to output to. These are implemented as macros, that
|
|
|
|
will provide the function with the needed arguments.
|
|
|
|
|
|
|
|
\param level Type of log event
|
Round 2 of IMAP_STORAGE app_voicemail.c fixes:
This fixes a bug that was thought to be fixed already.
app_voicemail, if using IMAP_STORAGE, has a problem because
the IMAP header files include syslog.h, which define LOG_WARNING
and LOG_DEBUG to be different than what Asterisk uses for those
same macros. This was "fixed" in the past by including all the
IMAP header files prior to including asterisk.h. This fix worked...
unless you were to try to compile with MALLOC_DEBUG. MALLOC_DEBUG
prepends the inclusion of astmm.h to every file, which means that no
matter what order the includes are in in app_voicemail, the unexpected
values for LOG_WARNING and LOG_DEBUG will be in place.
The action taken for this fix was to define AST_LOG_* macros in addition
to the LOG_* macros already defined. These new macros are used in app_voicemail.c,
logger.h, and astobj.h right now, and their use will be encouraged in the future.
In consideration of those who have written third-party modules which use
the LOG_* macros, these will NOT be removed from the source, however future use
of these macros is discouraged.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114577 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-23 00:58:49 +00:00
|
|
|
\param file Will be provided by the AST_LOG_* macro
|
|
|
|
\param line Will be provided by the AST_LOG_* macro
|
|
|
|
\param function Will be provided by the AST_LOG_* macro
|
2005-08-25 23:21:01 +00:00
|
|
|
\param fmt This is what is important. The format is the same as your favorite breed of printf. You know how that works, right? :-)
|
2001-11-01 14:03:04 +00:00
|
|
|
*/
|
2007-07-23 14:21:41 +00:00
|
|
|
|
2006-03-31 10:35:25 +00:00
|
|
|
void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...)
|
2002-06-21 01:40:13 +00:00
|
|
|
__attribute__ ((format (printf, 5, 6)));
|
2001-11-01 14:03:04 +00:00
|
|
|
|
2006-03-31 10:35:25 +00:00
|
|
|
void ast_backtrace(void);
|
2005-12-27 06:24:28 +00:00
|
|
|
|
2007-12-06 14:23:12 +00:00
|
|
|
/*! \brief Reload logger without rotating log files */
|
|
|
|
int logger_reload(void);
|
|
|
|
|
2006-03-31 10:35:25 +00:00
|
|
|
void ast_queue_log(const char *queuename, const char *callid, const char *agent, const char *event, const char *fmt, ...)
|
2004-02-12 22:11:02 +00:00
|
|
|
__attribute__ ((format (printf, 5, 6)));
|
|
|
|
|
2006-03-31 10:35:25 +00:00
|
|
|
/*! Send a verbose message (based on verbose level)
|
2005-08-25 23:21:01 +00:00
|
|
|
\brief This works like ast_log, but prints verbose messages to the console depending on verbosity level set.
|
|
|
|
ast_verbose(VERBOSE_PREFIX_3 "Whatever %s is happening\n", "nothing");
|
|
|
|
This will print the message to the console if the verbose level is set to a level >= 3
|
|
|
|
Note the abscence of a comma after the VERBOSE_PREFIX_3. This is important.
|
|
|
|
VERBOSE_PREFIX_1 through VERBOSE_PREFIX_3 are defined.
|
2001-11-01 14:03:04 +00:00
|
|
|
*/
|
2008-05-21 22:34:27 +00:00
|
|
|
void __ast_verbose(const char *file, int line, const char *func, const char *fmt, ...)
|
|
|
|
__attribute__ ((format (printf, 4, 5)));
|
|
|
|
|
|
|
|
#define ast_verbose(...) __ast_verbose(__FILE__, __LINE__, __PRETTY_FUNCTION__, __VA_ARGS__)
|
1999-10-27 00:56:38 +00:00
|
|
|
|
2008-04-16 22:57:54 +00:00
|
|
|
void ast_child_verbose(int level, const char *fmt, ...)
|
|
|
|
__attribute__ ((format (printf, 2, 3)));
|
|
|
|
|
2008-05-02 02:33:04 +00:00
|
|
|
int ast_register_verbose(void (*verboser)(const char *string)) __attribute__((warn_unused_result));
|
|
|
|
int ast_unregister_verbose(void (*verboser)(const char *string)) __attribute__((warn_unused_result));
|
Merge team/russell/ast_verbose_threadstorage
- instead of defining a free() wrapper in a bunch of files, define it as
ast_free() in utils.h and remove the copies from all the files.
- centralize and abstract the code used for doing thread storage. The code
lives in threadstorage.h, with one function being implemented in utils.c.
This new API includes generic thread storage as well as special functions
for handling thread local dynamic length string buffers.
- update ast_inet_ntoa() to use the new threadstorage API
- update ast_state2str() to use the new threadstorage API
- update ast_cli() to use the new threadstorage API
- Modify manager_event() to use thread storage. Instead of using a buffer of
4096 characters as the workspace for building the manager event, use a thread
local dynamic string. Now there is no length limitation on the length of the
body of a manager event.
- Significantly simplify the handling of ast_verbose() ...
- Instead of using a static char buffer and a lock to make sure only one
thread can be using ast_verbose() at a time, use a thread local dynamic
string as the workspace for preparing the verbose message. Instead of
locking around the entire function, the only locking done now is when the
message has been built and is being deliviered to the list of registered
verbose message handlers.
- This function was doing a strdup() on every message passed to it and
keeping a queue of the last 200 messages in memory. This has been
completely removed. The only place this was used was that if there were
any messages in the verbose queue when a verbose handler was registered,
all of the messages in the queue would be fed to it. So, I just made sure
that the console verbose handler and the network verbose handler (for
remote asterisk consoles) were registered before any verbose messages.
pbx_gtkconsole and pbx_kdeconsole will now lose a few verbose messages at
startup, but I didn't feel the performance hit of this message queue was
worth saving the initial verbose output for these very rarely used modules.
- I have removed the last three arguments to the verbose handlers, leaving
only the string itself because they aren't needed anymore. For example,
ast_verbose had some logic for telling the verbose handler to add
a newline if the buffer was completely full. Now that the buffer can grow
as needed, this doesn't matter anymore.
- remove unused function, ast_verbose_dmesg() which was to dispatch the
message queue
- Convert the list of verbose handlers to use the linked list macros.
- add missing newline characters to a few ast_verbose() calls
- convert the list of log channels to use the linked list macros in logger.c
- fix close_logger() to close all of the files it opened for logging
- update ast_log() to use a thread local dynamic string for its workspace
for preparing log messages instead of a buffer of size BUFSIZ (8kB on my
system) allocated on the stack. The dynamic string in this case is limited
to only growing to a maximum size of BUFSIZ.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@39272 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-08-08 06:32:04 +00:00
|
|
|
|
2006-03-31 10:35:25 +00:00
|
|
|
void ast_console_puts(const char *string);
|
2004-01-12 05:05:35 +00:00
|
|
|
|
2006-05-26 21:47:52 +00:00
|
|
|
void ast_console_puts_mutable(const char *string);
|
2007-10-13 05:53:19 +00:00
|
|
|
void ast_console_toggle_mute(int fd, int silent);
|
2006-05-26 19:48:17 +00:00
|
|
|
|
Round 2 of IMAP_STORAGE app_voicemail.c fixes:
This fixes a bug that was thought to be fixed already.
app_voicemail, if using IMAP_STORAGE, has a problem because
the IMAP header files include syslog.h, which define LOG_WARNING
and LOG_DEBUG to be different than what Asterisk uses for those
same macros. This was "fixed" in the past by including all the
IMAP header files prior to including asterisk.h. This fix worked...
unless you were to try to compile with MALLOC_DEBUG. MALLOC_DEBUG
prepends the inclusion of astmm.h to every file, which means that no
matter what order the includes are in in app_voicemail, the unexpected
values for LOG_WARNING and LOG_DEBUG will be in place.
The action taken for this fix was to define AST_LOG_* macros in addition
to the LOG_* macros already defined. These new macros are used in app_voicemail.c,
logger.h, and astobj.h right now, and their use will be encouraged in the future.
In consideration of those who have written third-party modules which use
the LOG_* macros, these will NOT be removed from the source, however future use
of these macros is discouraged.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114577 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-23 00:58:49 +00:00
|
|
|
/* Note: The AST_LOG_* macros below are the same as
|
|
|
|
* the LOG_* macros and are intended to eventually replace
|
|
|
|
* the LOG_* macros to avoid name collisions as has been
|
|
|
|
* seen in app_voicemail. However, please do NOT remove
|
|
|
|
* the LOG_* macros from the source since these may be still
|
|
|
|
* needed for third-party modules
|
|
|
|
*/
|
|
|
|
|
1999-10-27 00:56:38 +00:00
|
|
|
#define _A_ __FILE__, __LINE__, __PRETTY_FUNCTION__
|
|
|
|
|
2004-01-12 05:05:35 +00:00
|
|
|
#ifdef LOG_DEBUG
|
|
|
|
#undef LOG_DEBUG
|
|
|
|
#endif
|
|
|
|
#define __LOG_DEBUG 0
|
|
|
|
#define LOG_DEBUG __LOG_DEBUG, _A_
|
|
|
|
|
Round 2 of IMAP_STORAGE app_voicemail.c fixes:
This fixes a bug that was thought to be fixed already.
app_voicemail, if using IMAP_STORAGE, has a problem because
the IMAP header files include syslog.h, which define LOG_WARNING
and LOG_DEBUG to be different than what Asterisk uses for those
same macros. This was "fixed" in the past by including all the
IMAP header files prior to including asterisk.h. This fix worked...
unless you were to try to compile with MALLOC_DEBUG. MALLOC_DEBUG
prepends the inclusion of astmm.h to every file, which means that no
matter what order the includes are in in app_voicemail, the unexpected
values for LOG_WARNING and LOG_DEBUG will be in place.
The action taken for this fix was to define AST_LOG_* macros in addition
to the LOG_* macros already defined. These new macros are used in app_voicemail.c,
logger.h, and astobj.h right now, and their use will be encouraged in the future.
In consideration of those who have written third-party modules which use
the LOG_* macros, these will NOT be removed from the source, however future use
of these macros is discouraged.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114577 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-23 00:58:49 +00:00
|
|
|
#ifdef AST_LOG_DEBUG
|
|
|
|
#undef AST_LOG_DEBUG
|
|
|
|
#endif
|
|
|
|
#define AST_LOG_DEBUG __LOG_DEBUG, _A_
|
|
|
|
|
2004-01-12 05:05:35 +00:00
|
|
|
#ifdef LOG_EVENT
|
|
|
|
#undef LOG_EVENT
|
|
|
|
#endif
|
|
|
|
#define __LOG_EVENT 1
|
|
|
|
#define LOG_EVENT __LOG_EVENT, _A_
|
|
|
|
|
Round 2 of IMAP_STORAGE app_voicemail.c fixes:
This fixes a bug that was thought to be fixed already.
app_voicemail, if using IMAP_STORAGE, has a problem because
the IMAP header files include syslog.h, which define LOG_WARNING
and LOG_DEBUG to be different than what Asterisk uses for those
same macros. This was "fixed" in the past by including all the
IMAP header files prior to including asterisk.h. This fix worked...
unless you were to try to compile with MALLOC_DEBUG. MALLOC_DEBUG
prepends the inclusion of astmm.h to every file, which means that no
matter what order the includes are in in app_voicemail, the unexpected
values for LOG_WARNING and LOG_DEBUG will be in place.
The action taken for this fix was to define AST_LOG_* macros in addition
to the LOG_* macros already defined. These new macros are used in app_voicemail.c,
logger.h, and astobj.h right now, and their use will be encouraged in the future.
In consideration of those who have written third-party modules which use
the LOG_* macros, these will NOT be removed from the source, however future use
of these macros is discouraged.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114577 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-23 00:58:49 +00:00
|
|
|
#ifdef AST_LOG_EVENT
|
|
|
|
#undef AST_LOG_EVENT
|
|
|
|
#endif
|
|
|
|
#define AST_LOG_EVENT __LOG_EVENT, _A_
|
|
|
|
|
2004-01-12 05:05:35 +00:00
|
|
|
#ifdef LOG_NOTICE
|
|
|
|
#undef LOG_NOTICE
|
|
|
|
#endif
|
|
|
|
#define __LOG_NOTICE 2
|
|
|
|
#define LOG_NOTICE __LOG_NOTICE, _A_
|
|
|
|
|
Round 2 of IMAP_STORAGE app_voicemail.c fixes:
This fixes a bug that was thought to be fixed already.
app_voicemail, if using IMAP_STORAGE, has a problem because
the IMAP header files include syslog.h, which define LOG_WARNING
and LOG_DEBUG to be different than what Asterisk uses for those
same macros. This was "fixed" in the past by including all the
IMAP header files prior to including asterisk.h. This fix worked...
unless you were to try to compile with MALLOC_DEBUG. MALLOC_DEBUG
prepends the inclusion of astmm.h to every file, which means that no
matter what order the includes are in in app_voicemail, the unexpected
values for LOG_WARNING and LOG_DEBUG will be in place.
The action taken for this fix was to define AST_LOG_* macros in addition
to the LOG_* macros already defined. These new macros are used in app_voicemail.c,
logger.h, and astobj.h right now, and their use will be encouraged in the future.
In consideration of those who have written third-party modules which use
the LOG_* macros, these will NOT be removed from the source, however future use
of these macros is discouraged.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114577 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-23 00:58:49 +00:00
|
|
|
#ifdef AST_LOG_NOTICE
|
|
|
|
#undef AST_LOG_NOTICE
|
|
|
|
#endif
|
|
|
|
#define AST_LOG_NOTICE __LOG_NOTICE, _A_
|
|
|
|
|
2004-01-12 05:05:35 +00:00
|
|
|
#ifdef LOG_WARNING
|
|
|
|
#undef LOG_WARNING
|
|
|
|
#endif
|
|
|
|
#define __LOG_WARNING 3
|
|
|
|
#define LOG_WARNING __LOG_WARNING, _A_
|
|
|
|
|
Round 2 of IMAP_STORAGE app_voicemail.c fixes:
This fixes a bug that was thought to be fixed already.
app_voicemail, if using IMAP_STORAGE, has a problem because
the IMAP header files include syslog.h, which define LOG_WARNING
and LOG_DEBUG to be different than what Asterisk uses for those
same macros. This was "fixed" in the past by including all the
IMAP header files prior to including asterisk.h. This fix worked...
unless you were to try to compile with MALLOC_DEBUG. MALLOC_DEBUG
prepends the inclusion of astmm.h to every file, which means that no
matter what order the includes are in in app_voicemail, the unexpected
values for LOG_WARNING and LOG_DEBUG will be in place.
The action taken for this fix was to define AST_LOG_* macros in addition
to the LOG_* macros already defined. These new macros are used in app_voicemail.c,
logger.h, and astobj.h right now, and their use will be encouraged in the future.
In consideration of those who have written third-party modules which use
the LOG_* macros, these will NOT be removed from the source, however future use
of these macros is discouraged.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114577 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-23 00:58:49 +00:00
|
|
|
#ifdef AST_LOG_WARNING
|
|
|
|
#undef AST_LOG_WARNING
|
|
|
|
#endif
|
|
|
|
#define AST_LOG_WARNING __LOG_WARNING, _A_
|
|
|
|
|
2004-01-12 05:05:35 +00:00
|
|
|
#ifdef LOG_ERROR
|
|
|
|
#undef LOG_ERROR
|
|
|
|
#endif
|
|
|
|
#define __LOG_ERROR 4
|
|
|
|
#define LOG_ERROR __LOG_ERROR, _A_
|
1999-10-27 00:56:38 +00:00
|
|
|
|
Round 2 of IMAP_STORAGE app_voicemail.c fixes:
This fixes a bug that was thought to be fixed already.
app_voicemail, if using IMAP_STORAGE, has a problem because
the IMAP header files include syslog.h, which define LOG_WARNING
and LOG_DEBUG to be different than what Asterisk uses for those
same macros. This was "fixed" in the past by including all the
IMAP header files prior to including asterisk.h. This fix worked...
unless you were to try to compile with MALLOC_DEBUG. MALLOC_DEBUG
prepends the inclusion of astmm.h to every file, which means that no
matter what order the includes are in in app_voicemail, the unexpected
values for LOG_WARNING and LOG_DEBUG will be in place.
The action taken for this fix was to define AST_LOG_* macros in addition
to the LOG_* macros already defined. These new macros are used in app_voicemail.c,
logger.h, and astobj.h right now, and their use will be encouraged in the future.
In consideration of those who have written third-party modules which use
the LOG_* macros, these will NOT be removed from the source, however future use
of these macros is discouraged.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114577 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-23 00:58:49 +00:00
|
|
|
#ifdef AST_LOG_ERROR
|
|
|
|
#undef AST_LOG_ERROR
|
|
|
|
#endif
|
|
|
|
#define AST_LOG_ERROR __LOG_ERROR, _A_
|
|
|
|
|
2004-01-27 00:23:39 +00:00
|
|
|
#ifdef LOG_VERBOSE
|
|
|
|
#undef LOG_VERBOSE
|
|
|
|
#endif
|
|
|
|
#define __LOG_VERBOSE 5
|
|
|
|
#define LOG_VERBOSE __LOG_VERBOSE, _A_
|
|
|
|
|
Round 2 of IMAP_STORAGE app_voicemail.c fixes:
This fixes a bug that was thought to be fixed already.
app_voicemail, if using IMAP_STORAGE, has a problem because
the IMAP header files include syslog.h, which define LOG_WARNING
and LOG_DEBUG to be different than what Asterisk uses for those
same macros. This was "fixed" in the past by including all the
IMAP header files prior to including asterisk.h. This fix worked...
unless you were to try to compile with MALLOC_DEBUG. MALLOC_DEBUG
prepends the inclusion of astmm.h to every file, which means that no
matter what order the includes are in in app_voicemail, the unexpected
values for LOG_WARNING and LOG_DEBUG will be in place.
The action taken for this fix was to define AST_LOG_* macros in addition
to the LOG_* macros already defined. These new macros are used in app_voicemail.c,
logger.h, and astobj.h right now, and their use will be encouraged in the future.
In consideration of those who have written third-party modules which use
the LOG_* macros, these will NOT be removed from the source, however future use
of these macros is discouraged.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114577 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-23 00:58:49 +00:00
|
|
|
#ifdef AST_LOG_VERBOSE
|
|
|
|
#undef AST_LOG_VERBOSE
|
|
|
|
#endif
|
|
|
|
#define LOG_VERBOSE __LOG_VERBOSE, _A_
|
|
|
|
|
2005-08-22 21:19:59 +00:00
|
|
|
#ifdef LOG_DTMF
|
|
|
|
#undef LOG_DTMF
|
|
|
|
#endif
|
|
|
|
#define __LOG_DTMF 6
|
|
|
|
#define LOG_DTMF __LOG_DTMF, _A_
|
|
|
|
|
Round 2 of IMAP_STORAGE app_voicemail.c fixes:
This fixes a bug that was thought to be fixed already.
app_voicemail, if using IMAP_STORAGE, has a problem because
the IMAP header files include syslog.h, which define LOG_WARNING
and LOG_DEBUG to be different than what Asterisk uses for those
same macros. This was "fixed" in the past by including all the
IMAP header files prior to including asterisk.h. This fix worked...
unless you were to try to compile with MALLOC_DEBUG. MALLOC_DEBUG
prepends the inclusion of astmm.h to every file, which means that no
matter what order the includes are in in app_voicemail, the unexpected
values for LOG_WARNING and LOG_DEBUG will be in place.
The action taken for this fix was to define AST_LOG_* macros in addition
to the LOG_* macros already defined. These new macros are used in app_voicemail.c,
logger.h, and astobj.h right now, and their use will be encouraged in the future.
In consideration of those who have written third-party modules which use
the LOG_* macros, these will NOT be removed from the source, however future use
of these macros is discouraged.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114577 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-23 00:58:49 +00:00
|
|
|
#ifdef AST_LOG_DTMF
|
|
|
|
#undef AST_LOG_DTMF
|
|
|
|
#endif
|
|
|
|
#define AST_LOG_DTMF __LOG_DTMF, _A_
|
|
|
|
|
2007-07-23 14:21:41 +00:00
|
|
|
/*!
|
|
|
|
* \brief Get the debug level for a file
|
|
|
|
* \arg file the filename
|
|
|
|
* \return the debug level
|
|
|
|
*/
|
|
|
|
unsigned int ast_debug_get_by_file(const char *file);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Get the debug level for a file
|
|
|
|
* \arg file the filename
|
|
|
|
* \return the debug level
|
|
|
|
*/
|
|
|
|
unsigned int ast_verbose_get_by_file(const char *file);
|
|
|
|
|
2007-06-12 16:11:40 +00:00
|
|
|
/*!
|
|
|
|
* \brief Log a DEBUG message
|
|
|
|
* \param level The minimum value of option_debug for this message
|
|
|
|
* to get logged
|
|
|
|
*/
|
|
|
|
#define ast_debug(level, ...) do { \
|
2007-07-23 14:21:41 +00:00
|
|
|
if (option_debug >= (level) || (ast_opt_dbg_file && ast_debug_get_by_file(__FILE__) >= (level)) ) \
|
Round 2 of IMAP_STORAGE app_voicemail.c fixes:
This fixes a bug that was thought to be fixed already.
app_voicemail, if using IMAP_STORAGE, has a problem because
the IMAP header files include syslog.h, which define LOG_WARNING
and LOG_DEBUG to be different than what Asterisk uses for those
same macros. This was "fixed" in the past by including all the
IMAP header files prior to including asterisk.h. This fix worked...
unless you were to try to compile with MALLOC_DEBUG. MALLOC_DEBUG
prepends the inclusion of astmm.h to every file, which means that no
matter what order the includes are in in app_voicemail, the unexpected
values for LOG_WARNING and LOG_DEBUG will be in place.
The action taken for this fix was to define AST_LOG_* macros in addition
to the LOG_* macros already defined. These new macros are used in app_voicemail.c,
logger.h, and astobj.h right now, and their use will be encouraged in the future.
In consideration of those who have written third-party modules which use
the LOG_* macros, these will NOT be removed from the source, however future use
of these macros is discouraged.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114577 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-23 00:58:49 +00:00
|
|
|
ast_log(AST_LOG_DEBUG, __VA_ARGS__); \
|
2007-07-23 14:21:41 +00:00
|
|
|
} while (0)
|
|
|
|
|
2007-12-14 18:54:48 +00:00
|
|
|
#define VERBOSITY_ATLEAST(level) (option_verbose >= (level) || (ast_opt_verb_file && ast_verbose_get_by_file(__FILE__) >= (level)))
|
2007-12-14 18:47:44 +00:00
|
|
|
|
2007-07-23 14:21:41 +00:00
|
|
|
#define ast_verb(level, ...) do { \
|
2007-12-14 18:54:48 +00:00
|
|
|
if (VERBOSITY_ATLEAST((level)) ) { \
|
2007-07-23 14:21:41 +00:00
|
|
|
if (level >= 4) \
|
|
|
|
ast_verbose(VERBOSE_PREFIX_4 __VA_ARGS__); \
|
|
|
|
else if (level == 3) \
|
|
|
|
ast_verbose(VERBOSE_PREFIX_3 __VA_ARGS__); \
|
|
|
|
else if (level == 2) \
|
|
|
|
ast_verbose(VERBOSE_PREFIX_2 __VA_ARGS__); \
|
|
|
|
else if (level == 1) \
|
|
|
|
ast_verbose(VERBOSE_PREFIX_1 __VA_ARGS__); \
|
|
|
|
else \
|
|
|
|
ast_verbose(__VA_ARGS__); \
|
|
|
|
} \
|
2007-06-12 16:11:40 +00:00
|
|
|
} while (0)
|
|
|
|
|
1999-10-27 00:56:38 +00:00
|
|
|
#if defined(__cplusplus) || defined(c_plusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-08-30 18:32:10 +00:00
|
|
|
#endif /* _ASTERISK_LOGGER_H */
|