logger.hrl 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. %% Copyright (c) 2013-2019 EMQ Technologies Co., Ltd. All Rights Reserved.
  2. %%
  3. %% Licensed under the Apache License, Version 2.0 (the "License");
  4. %% you may not use this file except in compliance with the License.
  5. %% You may obtain a copy of the License at
  6. %%
  7. %% http://www.apache.org/licenses/LICENSE-2.0
  8. %%
  9. %% Unless required by applicable law or agreed to in writing, software
  10. %% distributed under the License is distributed on an "AS IS" BASIS,
  11. %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. %% See the License for the specific language governing permissions and
  13. %% limitations under the License.
  14. %% debug | info | notice | warning | error | critical | alert | emergency
  15. -define(DEBUG(Format), ?LOG(debug, Format, [])).
  16. -define(DEBUG(Format, Args), ?LOG(debug, Format, Args)).
  17. -define(INFO(Format), ?LOG(info, Format, [])).
  18. -define(INFO(Format, Args), ?LOG(info, Format, Args)).
  19. -define(NOTICE(Format), ?LOG(notice, Format, [])).
  20. -define(NOTICE(Format, Args), ?LOG(notice, Format, Args)).
  21. -define(WARN(Format), ?LOG(warning, Format, [])).
  22. -define(WARN(Format, Args), ?LOG(warning, Format, Args)).
  23. -define(ERROR(Format), ?LOG(error, Format, [])).
  24. -define(ERROR(Format, Args), ?LOG(error, Format, Args)).
  25. -define(CRITICAL(Format), ?LOG(critical, Format, [])).
  26. -define(CRITICAL(Format, Args), ?LOG(critical, Format, Args)).
  27. -define(ALERT(Format), ?LOG(alert, Format, [])).
  28. -define(ALERT(Format, Args), ?LOG(alert, Format, Args)).
  29. -define(LOG(Level, Format), ?LOG(Level, Format, [])).
  30. -define(LOG(Level, Format, Args),
  31. begin
  32. (logger:log(Level,#{},#{report_cb => fun(_) -> {(Format), (Args)} end}))
  33. end).