From af85769f423b4bd1042ad5f89710090cd8ae3a7e Mon Sep 17 00:00:00 2001 From: Magnus Ahltorp Date: Thu, 29 Jan 2015 13:56:43 +0100 Subject: Log leaf hashes as hex strings --- src/db.erl | 4 ++-- src/perm.erl | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src') 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 -- cgit v1.1