Compare commits
2 Commits
c9cdedf85c
...
d23196e746
| Author | SHA1 | Date | |
|---|---|---|---|
| d23196e746 | |||
| e9b1bccf57 |
@ -6,8 +6,6 @@
|
|||||||
|
|
||||||
-export([connect/4, slowly_connect/4]).
|
-export([connect/4, slowly_connect/4]).
|
||||||
|
|
||||||
-include("$zx_include/zx_logger.hrl").
|
|
||||||
|
|
||||||
|
|
||||||
connect(Node = {Host, Port}, Request, From, Timeout) ->
|
connect(Node = {Host, Port}, Request, From, Timeout) ->
|
||||||
Timer = erlang:send_after(Timeout, self(), timeout),
|
Timer = erlang:send_after(Timeout, self(), timeout),
|
||||||
@ -236,3 +234,9 @@ url({Node, Port}, Path) when is_list(Node) ->
|
|||||||
["https://", Node, ":", integer_to_list(Port), Path];
|
["https://", Node, ":", integer_to_list(Port), Path];
|
||||||
url({Node, Port}, Path) when is_tuple(Node) ->
|
url({Node, Port}, Path) when is_tuple(Node) ->
|
||||||
["https://", inet:ntoa(Node), ":", integer_to_list(Port), Path].
|
["https://", inet:ntoa(Node), ":", integer_to_list(Port), Path].
|
||||||
|
|
||||||
|
|
||||||
|
log(Level, Format, Args) ->
|
||||||
|
Raw = io_lib:format("~w ~w: " ++ Format, [?MODULE, self() | Args]),
|
||||||
|
Entry = unicode:characters_to_list(Raw),
|
||||||
|
logger:log(Level, Entry).
|
||||||
|
|||||||
@ -28,9 +28,6 @@
|
|||||||
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
|
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
|
||||||
code_change/3, terminate/2]).
|
code_change/3, terminate/2]).
|
||||||
|
|
||||||
%% TODO: Make logging more flexible
|
|
||||||
-include("$zx_include/zx_logger.hrl").
|
|
||||||
|
|
||||||
|
|
||||||
%%% Type and Record Definitions
|
%%% Type and Record Definitions
|
||||||
|
|
||||||
@ -268,3 +265,9 @@ do_request(Request,
|
|||||||
do_request(Request, From, State = #s{chain_nodes = {[], Used}}) ->
|
do_request(Request, From, State = #s{chain_nodes = {[], Used}}) ->
|
||||||
Fresh = lists:reverse(Used),
|
Fresh = lists:reverse(Used),
|
||||||
do_request(Request, From, State#s{chain_nodes = {Fresh, []}}).
|
do_request(Request, From, State#s{chain_nodes = {Fresh, []}}).
|
||||||
|
|
||||||
|
|
||||||
|
log(Level, Format, Args) ->
|
||||||
|
Raw = io_lib:format("~w ~w: " ++ Format, [?MODULE, self() | Args]),
|
||||||
|
Entry = unicode:characters_to_list(Raw),
|
||||||
|
logger:log(Level, Entry).
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user