~jaypipes/drizzle/new-test-runner

« back to all changes in this revision

Viewing changes to drizzled/log.h

  • Committer: Jay Pipes
  • Date: 2008-12-11 17:52:34 UTC
  • mfrom: (482.16.152 testable)
  • Revision ID: jpipes@serialcoder-20081211175234-uqsfvmgxejvmellq
merge with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
{
51
51
public:
52
52
  TC_LOG_DUMMY() {}
53
 
  int open(const char *opt_name __attribute__((unused)))
 
53
  int open(const char *)
54
54
  { return 0; }
55
55
  void close(void)                          { }
56
 
  int log_xid(Session *session __attribute__((unused)),
57
 
              my_xid xid __attribute__((unused)))         { return 1; }
58
 
  void unlog(ulong cookie __attribute__((unused)),
59
 
             my_xid xid __attribute__((unused)))  { }
 
56
  int log_xid(Session *, my_xid)         { return 1; }
 
57
  void unlog(ulong, my_xid)  { }
60
58
};
61
59
 
62
60
#ifdef HAVE_MMAP
362
360
  inline uint32_t get_open_count() { return open_count; }
363
361
};
364
362
 
 
363
 
 
364
File open_binlog(IO_CACHE *log, const char *log_file_name,
 
365
                 const char **errmsg);
 
366
bool flush_error_log(void);
 
367
 
365
368
class Log_event_handler
366
369
{
367
370
public:
374
377
  virtual ~Log_event_handler() {}
375
378
};
376
379
 
377
 
 
378
 
/* Class which manages slow, general and error log event handlers */
379
 
class LOGGER
380
 
{
381
 
  rw_lock_t LOCK_logger;
382
 
  /* flag to check whether logger mutex is initialized */
383
 
  uint32_t inited;
384
 
 
385
 
  /* NULL-terminated arrays of log handlers */
386
 
  Log_event_handler *error_log_handler_list[MAX_LOG_HANDLERS_NUM + 1];
387
 
 
388
 
public:
389
 
 
390
 
  LOGGER() : inited(0)
391
 
  {}
392
 
  void lock_shared() { rw_rdlock(&LOCK_logger); }
393
 
  void lock_exclusive() { rw_wrlock(&LOCK_logger); }
394
 
  void unlock() { rw_unlock(&LOCK_logger); }
395
 
  bool log_command(Session *session, enum enum_server_command command);
396
 
 
397
 
  /*
398
 
    We want to initialize all log mutexes as soon as possible,
399
 
    but we cannot do it in constructor, as safe_mutex relies on
400
 
    initialization, performed by MY_INIT(). This why this is done in
401
 
    this function.
402
 
  */
403
 
  void init_base();
404
 
  bool flush_logs(Session *session);
405
 
  /* Perform basic logger cleanup. this will leave e.g. error log open. */
406
 
  void cleanup_base();
407
 
  /* Free memory. Nothing could be logged after this function is called */
408
 
  void cleanup_end();
409
 
  bool error_log_print(enum loglevel level, const char *format,
410
 
                      va_list args);
411
 
  /* we use this function to setup all enabled log event handlers */
412
 
  int set_handlers(uint32_t error_log_printer);
413
 
  void init_error_log(uint32_t error_log_printer);
414
 
};
415
 
 
416
380
extern TYPELIB binlog_format_typelib;
417
381
 
418
382
void sql_print_error(const char *format, ...) __attribute__((format(printf, 1, 2)));
423
387
  __attribute__((format(printf, 1, 2)));
424
388
extern sql_print_message_func sql_print_message_handlers[];
425
389
 
426
 
int error_log_print(enum loglevel level, const char *format,
427
 
                    va_list args);
428
 
 
429
390
void sql_perror(const char *message);
430
391
 
431
392