rewrite from lager
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

34 行
746 B

4 年前
4 年前
4 年前
4 年前
4 年前
4 年前
4 年前
4 年前
4 年前
  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}.