summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2015-01-29 13:56:43 +0100
committerLinus Nordberg <linus@nordberg.se>2015-02-27 02:29:17 +0100
commitaf85769f423b4bd1042ad5f89710090cd8ae3a7e (patch)
tree19b905bca1cdf6d50b263730d09d9297c2f5fd1e
parent34b844901759cf4fa3abd461915212b1c59c9d7f (diff)
Log leaf hashes as hex strings
-rw-r--r--src/db.erl4
-rw-r--r--src/perm.erl14
2 files changed, 9 insertions, 9 deletions
diff --git a/src/db.erl b/src/db.erl
index 0361aaf..6430661 100644
--- a/src/db.erl
+++ b/src/db.erl
@@ -39,9 +39,9 @@ stop() ->
-spec add(binary(), binary()) -> ok.
add(LeafHash, Data) ->
- lager:debug("add leafhash ~p", [LeafHash]),
+ lager:debug("add leafhash ~s", [mochihex:to_hex(LeafHash)]),
ok = perm:ensurefile(entry_root_path(), LeafHash, Data),
- lager:debug("leafhash ~p added", [LeafHash]),
+ lager:debug("leafhash ~s added", [mochihex:to_hex(LeafHash)]),
ok.
-spec add_entryhash(binary(), binary()) -> ok.
diff --git a/src/perm.erl b/src/perm.erl
index 614656a..0cbe6cb 100644
--- a/src/perm.erl
+++ b/src/perm.erl
@@ -56,19 +56,19 @@ ensurefile_nosync(Rootdir, Key, Content) ->
ensurefile(Rootdir, Key, Content, nosync).
ensurefile(Rootdir, Key, Content, Syncflag) ->
- lager:debug("dir ~p key ~p", [Rootdir, Key]),
+ lager:debug("dir ~p key ~s", [Rootdir, mochihex:to_hex(Key)]),
{Dirs, Path} = path_for_key(Rootdir, Key),
case readfile_and_verify(Path, Content) of
ok ->
- lager:debug("key ~p existed, fsync", [Key]),
+ lager:debug("key ~s existed, fsync", [mochihex:to_hex(Key)]),
ok = util:fsync([Path, Rootdir | Dirs]),
- lager:debug("key ~p fsynced", [Key]),
+ lager:debug("key ~s fsynced", [mochihex:to_hex(Key)]),
ok;
differ ->
- lager:debug("key ~p existed, was different", [Key]),
+ lager:debug("key ~s existed, was different", [mochihex:to_hex(Key)]),
differ;
{error, enoent} ->
- lager:debug("key ~p didn't exist, add", [Key]),
+ lager:debug("key ~s didn't exist, add", [mochihex:to_hex(Key)]),
util:check_error(make_dirs([Rootdir, Rootdir ++ "nursery/"]
++ Dirs),
makedir, "Error creating directory"),
@@ -77,9 +77,9 @@ ensurefile(Rootdir, Key, Content, Syncflag) ->
util:write_tempfile_and_rename(Path, NurseryName, Content),
case Syncflag of
sync ->
- lager:debug("key ~p added, fsync", [Key]),
+ lager:debug("key ~s added, fsync", [mochihex:to_hex(Key)]),
ok = util:fsync([Path, Rootdir | Dirs]),
- lager:debug("key ~p fsynced", [Key]),
+ lager:debug("key ~s fsynced", [mochihex:to_hex(Key)]),
ok;
nosync ->
ok