From 239b1c6f7458e1c763b2e28de8eaf50f01ac7392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chmielowski?= Date: Tue, 26 Jan 2016 14:33:01 +0100 Subject: [PATCH] Always use lagger --- configure.ac | 13 ++------- include/logger.hrl | 22 -------------- rebar.config | 4 +-- src/ejabberd_logger.erl | 64 ----------------------------------------- vars.config.in | 1 - 5 files changed, 3 insertions(+), 101 deletions(-) diff --git a/configure.ac b/configure.ac index 85f65134f..e5d92c89d 100644 --- a/configure.ac +++ b/configure.ac @@ -100,9 +100,9 @@ AC_ARG_ENABLE(mssql, esac],[db_type=generic]) AC_ARG_ENABLE(all, -[AC_HELP_STRING([--enable-all], [same as --enable-odbc --enable-mysql --enable-pgsql --enable-sqlite --enable-pam --enable-zlib --enable-riak --enable-redis --enable-elixir --enable-iconv --enable-debug --enable-lager --enable-tools (useful for Dialyzer checks, default: no)])], +[AC_HELP_STRING([--enable-all], [same as --enable-odbc --enable-mysql --enable-pgsql --enable-sqlite --enable-pam --enable-zlib --enable-riak --enable-redis --enable-elixir --enable-iconv --enable-debug --enable-tools (useful for Dialyzer checks, default: no)])], [case "${enableval}" in - yes) odbc=true mysql=true pgsql=true sqlite=true pam=true zlib=true riak=true redis=true elixir=true iconv=true debug=true lager=true tools=true ;; + yes) odbc=true mysql=true pgsql=true sqlite=true pam=true zlib=true riak=true redis=true elixir=true iconv=true debug=true tools=true ;; no) odbc=false mysql=false pgsql=false sqlite=false pam=false zlib=false riak=false redis=false elixir=false iconv=false debug=false tools=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-all) ;; esac],[]) @@ -203,14 +203,6 @@ AC_ARG_ENABLE(debug, *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;; esac],[if test "x$debug" = "x"; then debug=true; fi]) -AC_ARG_ENABLE(lager, -[AC_HELP_STRING([--enable-lager], [enable lager support (default: yes)])], -[case "${enableval}" in - yes) lager=true ;; - no) lager=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-lager) ;; -esac],[if test "x$lager" = "x"; then lager=true; fi]) - AC_ARG_ENABLE(latest_deps, [AC_HELP_STRING([--enable-latest-deps], [makes rebar use latest commits for dependences instead of tagged versions (default: no)])], [case "${enableval}" in @@ -261,7 +253,6 @@ AC_SUBST(redis) AC_SUBST(elixir) AC_SUBST(iconv) AC_SUBST(debug) -AC_SUBST(lager) AC_SUBST(tools) AC_SUBST(latest_deps) AC_SUBST(CFLAGS) diff --git a/include/logger.hrl b/include/logger.hrl index b800cd0d5..18dc7041c 100644 --- a/include/logger.hrl +++ b/include/logger.hrl @@ -18,26 +18,6 @@ %%% %%%---------------------------------------------------------------------- -define(PRINT(Format, Args), io:format(Format, Args)). - --ifdef(P1LOGGER). - --define(DEBUG(Format, Args), - p1_logger:debug_msg(?MODULE, ?LINE, Format, Args)). - --define(INFO_MSG(Format, Args), - p1_logger:info_msg(?MODULE, ?LINE, Format, Args)). - --define(WARNING_MSG(Format, Args), - p1_logger:warning_msg(?MODULE, ?LINE, Format, Args)). - --define(ERROR_MSG(Format, Args), - p1_logger:error_msg(?MODULE, ?LINE, Format, Args)). - --define(CRITICAL_MSG(Format, Args), - p1_logger:critical_msg(?MODULE, ?LINE, Format, Args)). - --else. - -compile([{parse_transform, lager_transform}]). -define(DEBUG(Format, Args), @@ -54,5 +34,3 @@ -define(CRITICAL_MSG(Format, Args), lager:critical(Format, Args)). - --endif. diff --git a/rebar.config b/rebar.config index b1aae44ee..05d2ac1ba 100644 --- a/rebar.config +++ b/rebar.config @@ -7,8 +7,7 @@ %%% Created : 1 May 2013 by Evgeniy Khramtsov %%%------------------------------------------------------------------- -{deps, [{if_var_true, lager, {lager, ".*", {git, "https://github.com/basho/lager", {tag, "3.0.2"}}}}, - {if_var_false, lager, {p1_logger, ".*", {git, "https://github.com/processone/p1_logger", {tag, "1.0.0"}}}}, +{deps, [{lager, ".*", {git, "https://github.com/basho/lager", {tag, "3.0.2"}}}, {p1_utils, ".*", {git, "https://github.com/processone/p1_utils", {tag, "1.0.3"}}}, {cache_tab, ".*", {git, "https://github.com/processone/cache_tab", {tag, "1.0.2"}}}, {p1_tls, ".*", {git, "https://github.com/processone/tls", {tag, "1.0.0"}}}, @@ -53,7 +52,6 @@ {if_var_false, debug, no_debug_info}, {if_var_true, roster_gateway_workaround, {d, 'ROSTER_GATWAY_WORKAROUND'}}, {if_var_match, db_type, mssql, {d, 'mssql'}}, - {if_var_false, lager, {d, 'P1LOGGER'}}, {if_var_true, erlang_deprecated_types, {d, 'ERL_DEPRECATED_TYPES'}}, {if_var_true, hipe, native}, {src_dirs, [asn1, src, diff --git a/src/ejabberd_logger.erl b/src/ejabberd_logger.erl index 243864c7e..05499b45c 100644 --- a/src/ejabberd_logger.erl +++ b/src/ejabberd_logger.erl @@ -74,68 +74,6 @@ opt_type(log_rate_limit) -> opt_type(_) -> [log_rotate_date, log_rotate_size, log_rotate_count, log_rate_limit]. -%% Default logger module is LAGER, defined in else clause. -%% TODO: Remove p1_logger usage and allow using Elixir logger if running in Elixir context. --ifdef(P1LOGGER). - -start() -> - set(4), - LogPath = get_log_path(), - error_logger:add_report_handler(p1_logger_h, LogPath), - ok. - -reopen_log() -> - %% TODO: Use the Reopen log API for logger_h ? - p1_logger_h:reopen_log(), - reopen_sasl_log(). - -rotate_log() -> - %% Not implemented. - ok. - -get() -> - p1_loglevel:get(). - -set(LogLevel) when LogLevel >=0, LogLevel =< 5 -> - p1_loglevel:set(LogLevel); -set(LogLevel) -> - throw({wrong_loglevel, LogLevel}). - -%%%=================================================================== -%%% Internal functions -%%%=================================================================== -reopen_sasl_log() -> - case application:get_env(sasl,sasl_error_logger) of - {ok, {file, SASLfile}} -> - error_logger:delete_report_handler(sasl_report_file_h), - rotate_sasl_log(SASLfile), - error_logger:add_report_handler(sasl_report_file_h, - {SASLfile, get_sasl_error_logger_type()}); - _ -> false - end, - ok. - -rotate_sasl_log(Filename) -> - case file:read_file_info(Filename) of - {ok, _FileInfo} -> - file:rename(Filename, [Filename, ".0"]), - ok; - {error, _Reason} -> - ok - end. - -%% Function copied from Erlang/OTP lib/sasl/src/sasl.erl which doesn't export it -get_sasl_error_logger_type () -> - case application:get_env (sasl, errlog_type) of - {ok, error} -> error; - {ok, progress} -> progress; - {ok, all} -> all; - {ok, Bad} -> exit ({bad_config, {sasl, {errlog_type, Bad}}}); - _ -> all - end. - --else. - get_integer_env(Name, Default) -> case application:get_env(ejabberd, Name) of {ok, I} when is_integer(I), I>=0 -> @@ -242,5 +180,3 @@ set(LogLevel) when is_integer(LogLevel) -> set({_LogLevel, _}) -> error_logger:error_msg("custom loglevels are not supported for 'lager'"), {module, lager}. - --endif. diff --git a/vars.config.in b/vars.config.in index 991d20c9e..44316f8ae 100644 --- a/vars.config.in +++ b/vars.config.in @@ -27,7 +27,6 @@ {riak, @riak@}. {redis, @redis@}. {elixir, @elixir@}. -{lager, @lager@}. {iconv, @iconv@}. %% Version