Module: Groonga::WindowsEventLogger

Defined in:
ext/groonga/rb-grn-windows-event-logger.c

Class Method Summary collapse

Class Method Details

.register(event_source_name, options = {}) ⇒ void

This method returns an undefined value.

Registers Windows Event Log based logger that uses event_source_name as event source name.

Parameters:

  • event_source_name (String)

    The event source name.

  • options (::Hash) (defaults to: {})

Options Hash (options):

  • :context (Groonga::Context) — default: Groonga::Context.default

    The context to be set logger.

Since:

  • 5.0.5



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
# File 'ext/groonga/rb-grn-windows-event-logger.c', line 42

static VALUE
rb_grn_windows_event_logger_s_register (int argc,
                                        VALUE *argv,
                                        VALUE klass)
{
    VALUE rb_event_source_name;
    VALUE rb_options;
    VALUE rb_context;
    const char *event_source_name;
    grn_ctx *context;
    grn_rc rc;

    rb_scan_args(argc, argv, "11", &rb_event_source_name, &rb_options);
    rb_event_source_name = rb_grn_convert_to_string(rb_event_source_name);
    event_source_name = StringValueCStr(rb_event_source_name);

    rb_grn_scan_options(rb_options,
                        "context", &rb_context,
                        NULL);
    context = rb_grn_context_ensure(&rb_context);

    rc = grn_windows_event_logger_set(context, event_source_name);
    rb_grn_context_check(context, rb_event_source_name);
    rb_grn_rc_check(rc, rb_event_source_name);

    return Qnil;
}