From e4a52170414330494121428afd8dfa1e884769bf Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Mon, 31 Aug 2015 00:13:35 +1200 Subject: Displays package caching actions This makes it obvious where packages are cached and when the cache is being reused. Messages are of the form: ===> Fetching recon ({pkg,<<"recon">>,<<"2.2.0">>}) ===> Downloaded package, caching as $HOME/.cache/rebar3/hex/default/packages/recon-2.2.0.tar and ===> Fetching recon ({pkg,<<"recon">>,<<"2.2.0">>}) ===> Version cached at $HOME/.cache/rebar3/hex/default/packages/recon-2.2.0.tar is up to date, reusing it --- src/rebar_pkg_resource.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rebar_pkg_resource.erl b/src/rebar_pkg_resource.erl index 3430e81..4ac0a1d 100644 --- a/src/rebar_pkg_resource.erl +++ b/src/rebar_pkg_resource.erl @@ -37,11 +37,13 @@ download(TmpDir, Pkg={pkg, Name, Vsn}, State) -> cached_download(TmpDir, CachePath, Pkg={pkg, Name, Vsn}, Url, ETag, State) -> case request(Url, ETag) of {ok, cached} -> + ?INFO("Version cached at ~s is up to date, reusing it", [CachePath]), serve_from_cache(TmpDir, CachePath, Pkg, State); {ok, Body, NewETag} -> + ?INFO("Downloaded package, caching at ~s", [CachePath]), serve_from_download(TmpDir, CachePath, Pkg, NewETag, Body, State); error when ETag =/= false -> - ?DEBUG("Download ~s error, using ~s from cache", [Url, CachePath]), + ?INFO("Download error, using cached file at ~s", [CachePath]), serve_from_cache(TmpDir, CachePath, Pkg, State); error -> {fetch_fail, Name, Vsn} -- cgit v1.1