diff --git a/include/sqlite3.hrl b/include/sqlite3.hrl index b44e343..49482a7 100644 --- a/include/sqlite3.hrl +++ b/include/sqlite3.hrl @@ -1,2 +1,15 @@ +-ifdef(DEBUG). +-include_lib("eunit/include/eunit.hrl"). %% for debugging macros +-else. +-ifdef(TEST). +-include_lib("eunit/include/eunit.hrl"). %% for debugging macros +-else. +-define(debugMsg(_Message), ok). +-define(debugFmt(_Format, _Data), ok). +-define(debugVal(Expr), Expr). +-define(debugTime(_Text, Expr), Expr). +-endif. +-endif. + -define(NULL_ATOM, null). -type(sql_value() :: number() | ?NULL_ATOM | iodata()). diff --git a/src/sqlite3.erl b/src/sqlite3.erl index 71d752d..8ae235f 100644 --- a/src/sqlite3.erl +++ b/src/sqlite3.erl @@ -629,11 +629,11 @@ wait_result(Port) -> receive %% Messages given at http://www.erlang.org/doc/reference_manual/ports.html {Port, Reply} -> - % io:format("Reply: ~p~n", [Reply]), + % ?debugFmt("Reply: ~p~n", [Reply]), Reply; {'EXIT', Port, Reason} -> error_logger:error_msg("sqlite3 driver port closed with reason~p~n", [Reason]), - % io:format("Error: ~p~n", [Reason]), + ?debugFmt("Error: ~p~n", [Reason]), {error, Reason} %% ; %% _Else ->