1-module(ge_h). 2-vsn(2). 3-behaviour(gen_event). 4 5-export([get_events/1]). 6-export([init/1, handle_event/2, handle_call/2, handle_info/2, 7 terminate/2, code_change/3]). 8 9get_events(Mgr) -> 10 gen_event:call(Mgr, ge_h, get_events). 11 12init(_) -> {ok, []}. 13 14handle_event(Event, []) -> 15 {ok, [Event]}; 16handle_event(Event, [Event1 | _]) -> 17 {ok, [Event, Event1]}. 18 19handle_call(get_events, Events) -> 20 Events. 21 22handle_info(Info, Events) -> 23 {ok, Events}. 24 25terminate(Arg, Events) -> 26 ok. 27 28code_change(1, undefined, _Extra) -> 29 {ok, []}; 30code_change(1, LastEvent, _Extra) -> 31 {ok, [LastEvent]}. 32