rewrite from lager
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
746 B

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. -module(lager_slow_backend).
  2. -author("Sungjin Park <jinni.park@gmail.com>").
  3. -behavior(gen_event).
  4. -export([init/1, handle_call/2, handle_event/2, handle_info/2, terminate/2, code_change/3]).
  5. -include("eRum.hrl").
  6. -record(state, {
  7. delay :: non_neg_integer()
  8. }).
  9. init([{delay, Delay}]) ->
  10. {ok, #state{delay = Delay}}.
  11. handle_call(mGetLogLevel, State) ->
  12. {ok, rumUtil:configToMask(debug), State};
  13. handle_call(_Request, State) ->
  14. {ok, ok, State}.
  15. handle_event({mWriteLog, _Message}, State) ->
  16. timer:sleep(State#state.delay),
  17. {ok, State};
  18. handle_event(_Event, State) ->
  19. {ok, State}.
  20. handle_info(_Info, State) ->
  21. {ok, State}.
  22. terminate(_Reason, _State) ->
  23. ok.
  24. code_change(_OldVsn, State, _Extra) ->
  25. {ok, State}.