From ec3c13cade6f7d32a0a0bde8e42edb4501a72a56 Mon Sep 17 00:00:00 2001 From: Badlop Date: Wed, 19 Jul 2017 12:53:03 +0200 Subject: [PATCH] Move option checking to mod_opt_type, as introduced in fddd611 --- mod_post_log/src/mod_post_log.erl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mod_post_log/src/mod_post_log.erl b/mod_post_log/src/mod_post_log.erl index 20e7770..951eee3 100644 --- a/mod_post_log/src/mod_post_log.erl +++ b/mod_post_log/src/mod_post_log.erl @@ -42,7 +42,10 @@ stop(Host) -> depends(_Host, _Opts) -> []. -mod_opt_type(url) -> fun iolist_to_binary/1; +mod_opt_type(url) -> + fun(Val) when is_binary(Val) -> binary_to_list(Val); + (Val) -> Val + end; mod_opt_type(ts_header) -> fun iolist_to_binary/1; mod_opt_type(from_header) -> fun iolist_to_binary/1; mod_opt_type(to_header) -> fun iolist_to_binary/1; @@ -119,10 +122,7 @@ get_opt(LServer, Opt) -> get_opt(LServer, Opt, undefined). get_opt(LServer, Opt, Default) -> - F = fun(Val) when is_binary(Val) -> binary_to_list(Val); - (Val) -> Val - end, - gen_mod:get_module_opt(LServer, ?MODULE, Opt, F, Default). + gen_mod:get_module_opt(LServer, ?MODULE, Opt, Default). report_error(ReportArgs) -> ok = error_logger:error_report([ mod_post_log_cannot_post | ReportArgs ]).