how to pass a error_loger to erlang-mysql?

View: New views
1 Messages — Rating Filter:   Alert me  

how to pass a error_loger to erlang-mysql?

by wenew zhang :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

erlang-mysql driver have a LogFun Arg,i want pass error_loger:info_msg to
it,
i try:
mysql:start_link(...,error_loger:info_msg),
mysql:start_link(...,info_msg/2),
mysql:start_link(...,info_msg),
i can't work out!

some code below,i'm confused with log/4 and the macros defined


start_link(PoolId, Host, Port, User, Password, Database, LogFun) ->
init([PoolId, Host, Port, User, Password, Database, LogFun, Encoding]) ->
    LogFun1 = if LogFun == undefined -> fun log/4; true -> LogFun end,
--
-define(Log(LogFun,Level,Msg),
    LogFun(?MODULE, ?LINE,Level,fun()-> {Msg,[]} end)).
-define(Log2(LogFun,Level,Msg,Params),
    LogFun(?MODULE, ?LINE,Level,fun()-> {Msg,Params} end)).
-define(L(Msg), io:format("~p:~b ~p ~n", [?MODULE, ?LINE, Msg])).