Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

logger.h File Reference

#include <stdarg.h>

Include dependency graph for logger.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define EVENTLOG   "event_log"
#define DEBUG_M(a)
#define _A_   __FILE__, __LINE__, __PRETTY_FUNCTION__
#define __LOG_DEBUG   0
#define LOG_DEBUG   __LOG_DEBUG, _A_
#define __LOG_EVENT   1
#define LOG_EVENT   __LOG_EVENT, _A_
#define __LOG_NOTICE   2
#define LOG_NOTICE   __LOG_NOTICE, _A_
#define __LOG_WARNING   3
#define LOG_WARNING   __LOG_WARNING, _A_
#define __LOG_ERROR   4
#define LOG_ERROR   __LOG_ERROR, _A_
#define __LOG_VERBOSE   5
#define LOG_VERBOSE   __LOG_VERBOSE, _A_

Functions

void ast_log (int level, const char *file, int line, const char *function, const char *fmt,...) __attribute__((format(printf
 Used for sending a log message.

void ast_queue_log (const char *queuename, const char *callid, const char *agent, const char *event, const char *fmt,...) __attribute__((format(printf
void ast_verbose (const char *fmt,...) __attribute__((format(printf
 Send a verbose message (based on verbose level).

int ast_register_verbose (void(*verboser)(const char *string, int opos, int replacelast, int complete))
int ast_unregister_verbose (void(*verboser)(const char *string, int opos, int replacelast, int complete))
int ast_verbose_dmesg (void(*verboser)(const char *string, int opos, int replacelast, int complete))
void ast_console_puts (const char *string)


Define Documentation

#define __LOG_DEBUG   0
 

Definition at line 67 of file logger.h.

Referenced by ast_log().

#define __LOG_ERROR   4
 

Definition at line 91 of file logger.h.

#define __LOG_EVENT   1
 

Definition at line 73 of file logger.h.

Referenced by ast_log().

#define __LOG_NOTICE   2
 

Definition at line 79 of file logger.h.

#define __LOG_VERBOSE   5
 

Definition at line 97 of file logger.h.

Referenced by ast_log().

#define __LOG_WARNING   3
 

Definition at line 85 of file logger.h.

#define _A_   __FILE__, __LINE__, __PRETTY_FUNCTION__
 

Definition at line 62 of file logger.h.

#define DEBUG_M  ) 
 

Value:

{ \ a; \ }

Definition at line 25 of file logger.h.

#define EVENTLOG   "event_log"
 

Definition at line 23 of file logger.h.

Referenced by init_logger(), and reload_logger().

#define LOG_DEBUG   __LOG_DEBUG, _A_
 

Definition at line 68 of file logger.h.

Referenced by ast_append_ha(), ast_apply_ha(), ast_channel_bridge(), ast_channel_masquerade(), ast_channel_register_ex(), ast_channel_unregister(), ast_context_create(), ast_db_del(), ast_db_get(), ast_do_masquerade(), ast_dsp_process(), ast_get_enum(), ast_get_txt(), ast_hangup(), ast_indicate(), ast_io_add(), ast_io_dump(), ast_io_wait(), ast_ouraddrfor(), ast_pbx_run(), ast_prod(), ast_queue_frame(), ast_read(), ast_rtcp_read(), ast_rtp_bridge(), ast_rtp_read(), ast_rtp_write(), ast_sched_add(), ast_sched_del(), ast_sched_dump(), ast_sched_runq(), ast_sched_wait(), ast_search_dns(), ast_set_read_format(), ast_set_write_format(), ast_settimeout(), ast_softhangup_nolock(), ast_streamfile(), ast_waitstream(), ast_waitstream_fr(), ast_waitstream_full(), ast_writestream(), load_modules(), and pbx_substitute_variables_helper().

#define LOG_ERROR   __LOG_ERROR, _A_
 

Definition at line 92 of file logger.h.

Referenced by ast_add_extension2(), ast_channel_setoption(), ast_context_add_ignorepat2(), ast_context_add_include2(), ast_context_add_switch2(), ast_context_create(), ast_get_group(), ast_ouraddrfor(), ast_pbx_outgoing_app(), ast_pbx_outgoing_exten(), ast_pbx_run(), ast_register_application(), ast_register_switch(), ast_unregister_application(), ast_unregister_switch(), ast_verbose(), callerid_feed(), init_logger(), load_pbx(), main(), reload_logger(), and tdd_feed().

#define LOG_EVENT   __LOG_EVENT, _A_
 

Definition at line 74 of file logger.h.

Referenced by ast_log(), init_logger(), and reload_logger().

#define LOG_NOTICE   __LOG_NOTICE, _A_
 

Definition at line 80 of file logger.h.

Referenced by __ast_request_and_dial(), ast_app_getvoice(), ast_db_get(), ast_get_indication_zone(), ast_io_remove(), ast_read(), ast_rtp_read(), ast_rtp_senddigit(), ast_sched_add(), ast_sched_del(), ast_sched_runq(), ast_set_read_format(), ast_set_write_format(), ast_smoother_feed(), ast_unregister_indication_country(), callerid_feed(), init_manager(), pbx_substitute_variables_helper(), and tdd_feed().

#define LOG_VERBOSE   __LOG_VERBOSE, _A_
 

Definition at line 98 of file logger.h.

Referenced by ast_verbose().

#define LOG_WARNING   __LOG_WARNING, _A_
 

Definition at line 86 of file logger.h.

Referenced by __ast_context_destroy(), __ast_request_and_dial(), ast_add_extension2(), ast_app_getvoice(), ast_append_ha(), ast_async_goto(), ast_autoservice_start(), ast_best_codec(), ast_cdr_answer(), ast_cdr_busy(), ast_cdr_disposition(), ast_cdr_end(), ast_cdr_failed(), ast_cdr_free(), ast_cdr_init(), ast_cdr_post(), ast_cdr_register(), ast_cdr_setapp(), ast_cdr_setdestchan(), ast_cdr_start(), ast_channel_alloc(), ast_channel_bridge(), ast_channel_free(), ast_channel_make_compatible(), ast_channel_masquerade(), ast_channel_register_ex(), ast_channel_unregister(), ast_cli_command(), ast_cli_register(), ast_cli_unregister(), ast_context_create(), ast_context_verify_includes(), ast_db_gettree(), ast_db_put(), ast_device_state(), ast_do_masquerade(), ast_dsp_call_progress(), ast_dsp_digitdetect(), ast_dsp_process(), ast_dsp_silence(), ast_dtmf_stream(), ast_format_register(), ast_format_unregister(), ast_fr_fdread(), ast_fr_fdwrite(), ast_frisolate(), ast_get_group(), ast_get_indication_tone(), ast_get_indication_zone(), ast_get_ip(), ast_hangup(), ast_indicate(), ast_io_remove(), ast_linear_stream(), ast_load_resource(), ast_loader_register(), ast_loader_unregister(), ast_lookup_iface(), ast_manager_register2(), ast_merge_contexts_and_delete(), ast_openstream(), ast_openvstream(), ast_ouraddrfor(), ast_pbx_outgoing_app(), ast_pbx_outgoing_exten(), ast_pbx_run(), ast_pbx_start(), ast_playtones_start(), ast_prod(), ast_queue_frame(), ast_read(), ast_read_image(), ast_readfile(), ast_register_application(), ast_register_indication(), ast_register_indication_country(), ast_register_switch(), ast_register_translator(), ast_request(), ast_rtcp_read(), ast_rtp_bridge(), ast_rtp_new(), ast_rtp_proto_register(), ast_rtp_read(), ast_rtp_reload(), ast_rtp_senddigit(), ast_rtp_settos(), ast_rtp_write(), ast_safe_system(), ast_search_dns(), ast_smoother_feed(), ast_stopstream(), ast_streamfile(), ast_translate(), ast_translator_build_path(), ast_unload_resource(), ast_unregister_indication(), ast_unregister_indication_country(), ast_update_use_count(), ast_var_assign(), ast_waitfor_n_fd(), ast_waitfor_nandfds(), ast_waitfordigit_full(), ast_waitstream(), ast_waitstream_fr(), ast_waitstream_full(), ast_write(), ast_writefile(), ast_writestream(), callerid_feed(), callerid_new(), init_manager(), load_modules(), main(), pbx_builtin_setvar(), pbx_exec(), pbx_findapp(), tdd_feed(), and tdd_new().


Function Documentation

void ast_console_puts const char *  string  ) 
 

Definition at line 216 of file asterisk.c.

References string.

Referenced by ast_log().

00217 { 00218 fputs(string, stdout); 00219 fflush(stdout); 00220 ast_network_puts(string); 00221 }

void ast_log int  level,
const char *  file,
int  line,
const char *  function,
const char *  fmt,
  ...
 

Used for sending a log message.

Parameters:
level don't need to worry about it
file ditto
line ditto
function ditto
fmt this is what is important. The format is the same as your favorite breed of printf. You know how that works, right? :-) This is the standard logger function. Probably the only way you will invoke it would be something like this: ast_log(LOG_WHATEVER, "Problem with the %s Captain. We should get some more. Will %d be enough?", "flux capacitor", 10); where WHATEVER is one of ERROR, DEBUG, EVENT, NOTICE, or WARNING depending on which log you wish to output to.

Referenced by __ast_context_destroy(), __ast_request_and_dial(), ast_add_extension2(), ast_app_getvoice(), ast_append_ha(), ast_apply_ha(), ast_async_goto(), ast_autoservice_start(), ast_best_codec(), ast_cdr_answer(), ast_cdr_busy(), ast_cdr_disposition(), ast_cdr_end(), ast_cdr_failed(), ast_cdr_free(), ast_cdr_init(), ast_cdr_post(), ast_cdr_register(), ast_cdr_setapp(), ast_cdr_setdestchan(), ast_cdr_start(), ast_channel_alloc(), ast_channel_bridge(), ast_channel_free(), ast_channel_make_compatible(), ast_channel_masquerade(), ast_channel_register_ex(), ast_channel_setoption(), ast_channel_unregister(), ast_cli_command(), ast_cli_register(), ast_cli_unregister(), ast_context_add_ignorepat2(), ast_context_add_include2(), ast_context_add_switch2(), ast_context_create(), ast_context_verify_includes(), ast_db_del(), ast_db_get(), ast_db_gettree(), ast_db_put(), ast_device_state(), ast_do_masquerade(), ast_dsp_call_progress(), ast_dsp_digitdetect(), ast_dsp_process(), ast_dsp_silence(), ast_dtmf_stream(), ast_format_register(), ast_format_unregister(), ast_fr_fdread(), ast_fr_fdwrite(), ast_frisolate(), ast_get_enum(), ast_get_group(), ast_get_indication_tone(), ast_get_indication_zone(), ast_get_ip(), ast_get_txt(), ast_hangup(), ast_indicate(), ast_io_add(), ast_io_dump(), ast_io_remove(), ast_io_wait(), ast_linear_stream(), ast_load_resource(), ast_loader_register(), ast_loader_unregister(), ast_log(), ast_lookup_iface(), ast_manager_register2(), ast_merge_contexts_and_delete(), ast_openstream(), ast_openvstream(), ast_ouraddrfor(), ast_pbx_outgoing_app(), ast_pbx_outgoing_exten(), ast_pbx_run(), ast_pbx_start(), ast_playtones_start(), ast_prod(), ast_queue_frame(), ast_read(), ast_read_image(), ast_readfile(), ast_register_application(), ast_register_indication(), ast_register_indication_country(), ast_register_switch(), ast_register_translator(), ast_request(), ast_rtcp_read(), ast_rtp_bridge(), ast_rtp_new(), ast_rtp_proto_register(), ast_rtp_read(), ast_rtp_reload(), ast_rtp_senddigit(), ast_rtp_settos(), ast_rtp_write(), ast_safe_system(), ast_sched_add(), ast_sched_del(), ast_sched_dump(), ast_sched_runq(), ast_sched_wait(), ast_search_dns(), ast_set_read_format(), ast_set_write_format(), ast_settimeout(), ast_smoother_feed(), ast_softhangup_nolock(), ast_stopstream(), ast_streamfile(), ast_translate(), ast_translator_build_path(), ast_unload_resource(), ast_unregister_application(), ast_unregister_indication(), ast_unregister_indication_country(), ast_unregister_switch(), ast_update_use_count(), ast_var_assign(), ast_verbose(), ast_waitfor_n_fd(), ast_waitfor_nandfds(), ast_waitfordigit_full(), ast_waitstream(), ast_waitstream_fr(), ast_waitstream_full(), ast_write(), ast_writefile(), ast_writestream(), callerid_feed(), callerid_new(), init_logger(), init_manager(), load_modules(), load_pbx(), main(), pbx_builtin_setvar(), pbx_exec(), pbx_findapp(), pbx_substitute_variables_helper(), reload_logger(), tdd_feed(), and tdd_new().

void ast_queue_log const char *  queuename,
const char *  callid,
const char *  agent,
const char *  event,
const char *  fmt,
  ...
 

int ast_register_verbose void(*  verboser)(const char *string, int opos, int replacelast, int complete)  ) 
 

Definition at line 629 of file logger.c.

References ast_mutex_lock, ast_mutex_unlock, and malloc.

Referenced by main().

00630 { 00631 struct msglist *m; 00632 struct verb *tmp; 00633 /* XXX Should be more flexible here, taking > 1 verboser XXX */ 00634 if ((tmp = malloc(sizeof (struct verb)))) { 00635 tmp->verboser = v; 00636 ast_mutex_lock(&msglist_lock); 00637 tmp->next = verboser; 00638 verboser = tmp; 00639 m = list; 00640 while(m) { 00641 /* Send all the existing entries that we have queued (i.e. they're likely to have missed) */ 00642 v(m->msg, 0, 0, 1); 00643 m = m->next; 00644 } 00645 ast_mutex_unlock(&msglist_lock); 00646 return 0; 00647 } 00648 return -1; 00649 }

int ast_unregister_verbose void(*  verboser)(const char *string, int opos, int replacelast, int complete)  ) 
 

Definition at line 651 of file logger.c.

References ast_mutex_lock, ast_mutex_unlock, and free.

00652 { 00653 int res = -1; 00654 struct verb *tmp, *tmpl=NULL; 00655 ast_mutex_lock(&msglist_lock); 00656 tmp = verboser; 00657 while(tmp) { 00658 if (tmp->verboser == v) { 00659 if (tmpl) 00660 tmpl->next = tmp->next; 00661 else 00662 verboser = tmp->next; 00663 free(tmp); 00664 break; 00665 } 00666 tmpl = tmp; 00667 tmp = tmp->next; 00668 } 00669 if (tmp) 00670 res = 0; 00671 ast_mutex_unlock(&msglist_lock); 00672 return res; 00673 }

void ast_verbose const char *  fmt,
  ...
 

Send a verbose message (based on verbose level).

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.

Referenced by ast_cdr_unregister(), ast_channel_bridge(), ast_channel_register_ex(), ast_channel_unregister(), ast_context_add_include2(), ast_context_add_switch2(), ast_context_create(), ast_format_register(), ast_format_unregister(), ast_frame_dump(), ast_image_register(), ast_image_unregister(), ast_load_resource(), ast_log(), ast_manager_unregister(), ast_module_reload(), ast_pbx_outgoing_app(), ast_pbx_outgoing_exten(), ast_pbx_run(), ast_register_application(), ast_register_indication_country(), ast_register_translator(), ast_rtp_reload(), ast_save(), ast_set_indication_country(), ast_streamfile(), ast_unregister_application(), ast_unregister_indication_country(), ast_unregister_translator(), init_logger(), init_manager(), load_modules(), load_pbx(), main(), pbx_builtin_setvar_helper(), and reload_logger().

int ast_verbose_dmesg void(*  verboser)(const char *string, int opos, int replacelast, int complete)  ) 
 

Definition at line 615 of file logger.c.

References ast_mutex_lock, and ast_mutex_unlock.

00616 { 00617 struct msglist *m; 00618 m = list; 00619 ast_mutex_lock(&msglist_lock); 00620 while(m) { 00621 /* Send all the existing entries that we have queued (i.e. they're likely to have missed) */ 00622 v(m->msg, 0, 0, 1); 00623 m = m->next; 00624 } 00625 ast_mutex_unlock(&msglist_lock); 00626 return 0; 00627 }


Generated on Sat Jun 12 16:41:39 2004 for Asterisk by doxygen 1.3.7