summaryrefslogtreecommitdiff
path: root/logger.c
AgeCommit message (Collapse)Author
2006-08-08Merge team/russell/ast_verbose_threadstorageRussell Bryant
- 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-07-28As discussed and decided on the asterisk-dev mailing list ...Russell Bryant
- Fix some breakage I introduced a while ago that made the timestamps option not functional for CLI verbose output. - Remove the use of the timestamps option for log output, since it was not functional. - clarify text referring to the timestamps option so that it is clear that it only applies to CLI verbose output git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@38439 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-07-21slightly simplify a loop and replace an open coded version of ast_skip_blanksRussell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@38068 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-06-09there is no reason to define our own 'maximum path length' when the POSIX ↵Kevin P. Fleming
headers already define one for us git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@33351 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-06-07simplify autoconfig include mechanism (make tholo happy he can use lint ↵Kevin P. Fleming
again :-) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@32846 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-05-26Add ability to disable log / verbose output to remote consoles (issue #6524 ↵Joshua Colp
reported by mavetju) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@30603 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-05-24Merged revisions 30033 via svnmerge from Joshua Colp
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r30033 | file | 2006-05-24 16:14:01 -0300 (Wed, 24 May 2006) | 2 lines Fix deadlock caused by a race condition in the logger when reloading (issue #7195 reported and fixed by softins) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@30034 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-05-10remove almost all of the checks of the result from ast_strdupa() or alloca().Russell Bryant
As it turns out, all of these checks were useless, because alloca will never return NULL. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@26451 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-05-08 use pid_t instead of long for pid variables. #7099 (casper)BJ Weschke
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@25488 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-02-27conversions to allocation wrappers and coding guidelines fixes (issue #6592)Russell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@11232 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-02-26Merged revisions 11165 via svnmerge from Tilghman Lesher
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r11165 | tilghman | 2006-02-26 10:26:39 -0600 (Sun, 26 Feb 2006) | 2 lines Bug 5950 - reenable queue log rotation; also, eliminate redundant code ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@11166 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-02-22use a symbolic constant instead of a magic number (tholo!)Kevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@10786 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-02-22Typo: should have been changed to a constantTilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@10784 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-02-15changed LOG_WARNING to LOG_DEBUG for backtraceMatt O'Gorman
messages (issue #6497) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@10195 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-02-08Merged revisions 9232 via svnmerge from Matt O'Gorman
https://svn.digium.com/svn/asterisk/branches/1.2 ........ r9232 | mogorman | 2006-02-08 16:12:34 -0600 (Wed, 08 Feb 2006) | 4 lines Make logger report error,warning,notice if logger.conf not found, also updated chan_oss to give correct error message if its config file is not found. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@9239 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-01-20More doxygen updatesOlle Johansson
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@8315 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-01-17Merged revisions 7963 via svnmerge from Matt O'Gorman
https://svn.digium.com/svn/asterisk/branches/1.2 ........ r7963 | mogorman | 2006-01-10 22:38:07 -0600 (Tue, 10 Jan 2006) | 2 lines Minor typo refrenced in 6191 ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@8125 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-12-30update doxygen docs to specify authorsRussell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7682 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-12-27Bug 5183 - Inline stack backtracesTilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7646 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-12-04convert most of the option_*'s to a single ast_flags structure. Also, fix someRussell Bryant
formatting, remove some unnecessary casts, and other little code cleanups. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7331 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-11-29remove extraneous svn:executable propertiesKevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7221 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-10-24Doxygen documentation update from oej (issue #5505)Russell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6847 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-10-05use thread ID instead of process ID in logger messages (issue #5349)Kevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6726 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-09-26ensure that if the verbose buffer is full, we send it out even if it's not ↵Kevin P. Fleming
complete (issue #5263, patch modified to actually compile) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6662 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-09-15correct accidental logic reversalKevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6616 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-09-14clean up ast_verbose(), don't hold the lock any longer than neededKevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6606 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-09-14update MANY more files with proper copyright/license info (thanks Ian!)Kevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6596 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-08-31make DEBUG_THREADS have more visible loggingKevin P. Fleming
make DEBUG_THREADS able to catch locks being unlocked by threads that did not own them add proper wrappers for pthread_cond_wait() and pthread_cond_timedwait() for DEBUG_THREADS mode git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6464 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-08-22add a LOG_DTMF logging channel and send all bridged DTMF events out that ↵Kevin P. Fleming
channel (issue #4835) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6358 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-08-15Allow Asterisk to start even when eventlog is turned off (bug #4938)Mark Spencer
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6337 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-07-10more ast_copy_string conversionsRussell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6073 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-07-05ensure that filesize-triggered reloads don't recurse (bug #4621, with mods)Kevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6031 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-06-06more file version tagsKevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5866 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-06-06remove experimental module version tagsKevin P. Fleming
add per-file revision tags and 'show version files' CLI command git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5864 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-06-06major Makefile and build process improvements, including removal of all ↵Kevin P. Fleming
hardcoded paths (modules must now use run-time paths as they should) (bug #4116) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5855 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-05-20clarify comments even moreKevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5749 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-05-20add a little comment to keep someone else from having the same ↵Kevin P. Fleming
misunderstanding I had :-) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5748 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-05-19Revert improper patch from bug #4294Mark Spencer
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5744 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-05-19properly check for debug and verbose messages to suppress (bug #4294)Kevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5726 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-05-14Fix logger check (bug #4260)Mark Spencer
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5650 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-05-08Fix gethostname calls (bug #4198, with mods)Mark Spencer
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5600 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-04-22phase 1 of header include cleanup (bug #4067)Kevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5498 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-04-21use double-quotes instead of angle-brackets for non-system include files ↵Kevin P. Fleming
(bug #4058) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5490 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-04-03fix obvious coding error from yesterday's fixKevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5369 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-04-02don't unnecessarily open-code strchr()Kevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5361 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-04-01strip color code sequences from verbose messages being sent to files/syslog ↵Kevin P. Fleming
(bug #3929, with mods) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5354 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-04-01Put syslog facility/level name into filename field, so it will show in ↵Kevin P. Fleming
'logger show channels' (bug #3916) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5339 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-03-31Make logger respond better to lack of disk space and add "logger show ↵Mark Spencer
channels" CLI (bug #3909 with minor mods) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5321 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-03-28No need for sizeof (bug #3887)Mark Spencer
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5294 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2005-03-11Apply queuelog patch and perform final test of "test patches" systemMark Spencer
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5168 65c4cc65-6c06-0410-ace0-fbb531ad65f3