~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/log.cc

  • 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:
44
44
/* max size of the log message */
45
45
#define MY_OFF_T_UNDEF (~(my_off_t)0UL)
46
46
 
47
 
LOGGER logger;
48
 
 
49
47
DRIZZLE_BIN_LOG drizzle_bin_log;
50
48
uint64_t sync_binlog_counter= 0; /* We should rationalize the largest possible counters for binlog sync */
51
49
 
203
201
handlerton *binlog_hton;
204
202
 
205
203
 
206
 
/*
207
 
  Log error with all enabled log event handlers
208
 
 
209
 
  SYNOPSIS
210
 
    error_log_print()
211
 
 
212
 
    level             The level of the error significance: NOTE,
213
 
                      WARNING or ERROR.
214
 
    format            format string for the error message
215
 
    args              list of arguments for the format string
216
 
 
217
 
  RETURN
218
 
    FALSE - OK
219
 
    TRUE - error occured
220
 
*/
221
 
 
222
 
bool LOGGER::error_log_print(enum loglevel level, const char *format,
223
 
                             va_list args)
224
 
{
225
 
  bool error= false;
226
 
  Log_event_handler **current_handler;
227
 
 
228
 
  /* currently we don't need locking here as there is no error_log table */
229
 
  for (current_handler= error_log_handler_list ; *current_handler ;)
230
 
    error= (*current_handler++)->log_error(level, format, args) || error;
231
 
 
232
 
  return error;
233
 
}
234
 
 
235
 
 
236
 
void LOGGER::cleanup_base()
237
 
{
238
 
  assert(inited == 1);
239
 
  rwlock_destroy(&LOCK_logger);
240
 
}
241
 
 
242
 
 
243
 
void LOGGER::cleanup_end()
244
 
{
245
 
  assert(inited == 1);
246
 
}
247
 
 
248
 
 
249
 
/**
250
 
  Perform basic log initialization: create file-based log handler and
251
 
  init error log.
252
 
*/
253
 
void LOGGER::init_base()
254
 
{
255
 
  assert(inited == 0);
256
 
  inited= 1;
257
 
 
258
 
  /* by default we use traditional error log */
259
 
  init_error_log(LOG_FILE);
260
 
 
261
 
  my_rwlock_init(&LOCK_logger, NULL);
262
 
}
263
 
 
264
 
 
265
 
bool LOGGER::flush_logs(Session *)
266
 
{
267
 
  int rc= 0;
268
 
 
269
 
  /*
270
 
    Now we lock logger, as nobody should be able to use logging routines while
271
 
    log tables are closed
272
 
  */
273
 
  logger.lock_exclusive();
274
 
 
275
 
  /* end of log flush */
276
 
  logger.unlock();
277
 
  return rc;
278
 
}
279
 
 
280
 
void LOGGER::init_error_log(uint32_t error_log_printer)
281
 
{
282
 
  if (error_log_printer & LOG_NONE)
283
 
  {
284
 
    error_log_handler_list[0]= 0;
285
 
    return;
286
 
  }
287
 
 
288
 
}
289
 
 
290
 
int LOGGER::set_handlers(uint32_t error_log_printer)
291
 
{
292
 
  /* error log table is not supported yet */
293
 
  lock_exclusive();
294
 
 
295
 
  init_error_log(error_log_printer);
296
 
  unlock();
297
 
 
298
 
  return 0;
299
 
}
300
 
 
301
 
 
302
204
 /*
303
205
  Save position of binary log transaction cache.
304
206
 
2566
2468
  return(error);
2567
2469
}
2568
2470
 
2569
 
 
2570
 
int error_log_print(enum loglevel level, const char *format,
2571
 
                    va_list args)
2572
 
{
2573
 
  return logger.error_log_print(level, format, args);
2574
 
}
2575
 
 
2576
2471
void DRIZZLE_BIN_LOG::rotate_and_purge(uint32_t flags)
2577
2472
{
2578
2473
  if (!(flags & RP_LOCK_LOG_IS_ALREADY_LOCKED))