1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
/*-
* Copyright (c) 2008-2012 WiredTiger, Inc.
* All rights reserved.
*
* See the file LICENSE for redistribution information.
*/
#include "wt_internal.h"
/*
* __handle_error_default --
* Default WT_EVENT_HANDLER->handle_error implementation: send to stderr.
*/
static void
__handle_error_default(WT_EVENT_HANDLER *handler, int error, const char *errmsg)
{
size_t len_err, len_errmsg;
const char *err;
WT_UNUSED(handler);
if (error != 0) {
err = wiredtiger_strerror(error);
len_err = strlen(err);
len_errmsg = strlen(errmsg);
if (len_err >= len_errmsg &&
strcmp(errmsg + (len_errmsg - len_err), err) != 0) {
fprintf(stderr,
"%s: %s\n", errmsg, wiredtiger_strerror(error));
return;
}
}
fprintf(stderr, "%s\n", errmsg);
}
/*
* __handle_message_default --
* Default WT_EVENT_HANDLER->handle_message implementation: send to stdout.
*/
static int
__handle_message_default(WT_EVENT_HANDLER *handler, const char *message)
{
WT_UNUSED(handler);
printf("%s\n", message);
return (0);
}
/*
* __handle_progress_default --
* Default WT_EVENT_HANDLER->handle_progress implementation: ignore.
*/
static int
__handle_progress_default(WT_EVENT_HANDLER *handler,
const char *operation, uint64_t progress)
{
WT_UNUSED(handler);
WT_UNUSED(operation);
WT_UNUSED(progress);
return (0);
}
static WT_EVENT_HANDLER __event_handler_default = {
__handle_error_default,
__handle_message_default,
__handle_progress_default
};
WT_EVENT_HANDLER *__wt_event_handler_default = &__event_handler_default;
|