~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/log.h

  • Committer: Brian Aker
  • Date: 2008-12-05 19:17:37 UTC
  • Revision ID: brian@tangent.org-20081205191737-pp8u84pdz6dcp182
Part removal of my_pthread.h

Show diffs side-by-side

added added

removed removed

Lines of Context:
372
372
  virtual ~Log_event_handler() {}
373
373
};
374
374
 
375
 
 
376
 
/* Class which manages slow, general and error log event handlers */
377
 
class LOGGER
378
 
{
379
 
  rw_lock_t LOCK_logger;
380
 
  /* flag to check whether logger mutex is initialized */
381
 
  uint32_t inited;
382
 
 
383
 
  /* NULL-terminated arrays of log handlers */
384
 
  Log_event_handler *error_log_handler_list[MAX_LOG_HANDLERS_NUM + 1];
385
 
 
386
 
public:
387
 
 
388
 
  LOGGER() : inited(0)
389
 
  {}
390
 
  void lock_shared() { rw_rdlock(&LOCK_logger); }
391
 
  void lock_exclusive() { rw_wrlock(&LOCK_logger); }
392
 
  void unlock() { rw_unlock(&LOCK_logger); }
393
 
  bool log_command(Session *session, enum enum_server_command command);
394
 
 
395
 
  /*
396
 
    We want to initialize all log mutexes as soon as possible,
397
 
    but we cannot do it in constructor, as safe_mutex relies on
398
 
    initialization, performed by MY_INIT(). This why this is done in
399
 
    this function.
400
 
  */
401
 
  void init_base();
402
 
  bool flush_logs(Session *session);
403
 
  /* Perform basic logger cleanup. this will leave e.g. error log open. */
404
 
  void cleanup_base();
405
 
  /* Free memory. Nothing could be logged after this function is called */
406
 
  void cleanup_end();
407
 
  bool error_log_print(enum loglevel level, const char *format,
408
 
                      va_list args);
409
 
  /* we use this function to setup all enabled log event handlers */
410
 
  int set_handlers(uint32_t error_log_printer);
411
 
  void init_error_log(uint32_t error_log_printer);
412
 
};
413
 
 
414
375
extern TYPELIB binlog_format_typelib;
415
376
 
416
377
void sql_print_error(const char *format, ...) __attribute__((format(printf, 1, 2)));
421
382
  __attribute__((format(printf, 1, 2)));
422
383
extern sql_print_message_func sql_print_message_handlers[];
423
384
 
424
 
int error_log_print(enum loglevel level, const char *format,
425
 
                    va_list args);
426
 
 
427
385
void sql_perror(const char *message);
428
386
 
429
387