# HG changeset patch # User Matthew Wild # Date 1262800321 0 # Node ID fd77e75c489187c332da6149d13f0ecb7dd2d88f # Parent 58c6944924595c1c99364db3852302752c2b7c15 clix: Make more use of Verse's new logging controls diff -r 58c694492459 -r fd77e75c4891 clix.lua --- a/clix.lua Wed Jan 06 17:33:16 2010 +0000 +++ b/clix.lua Wed Jan 06 17:52:01 2010 +0000 @@ -50,18 +50,19 @@ io.stderr:write("The specified account (", opts.account or "default", ") wasn't found in the config file\n"); return nil; end - - local conn = verse.new(); + verse.set_logger(function () end); + local conn = verse.new(verse.logger()); + conn.log.debug = opts.verbose; conn:hook("authentication-failure", function (err) - io.stderr:write("Authentication failure (",err.condition or "unknown error", ")", err.text and (": "..err.text) or "", "\n"); + conn:error("Authentication failure ("..(err.condition or "unknown error")..")"..(err.text and (": "..err.text) or "")); end); - conn:hook("binding-success", function () io.stderr:write("Connected: ", tostring(conn), "\n"); return on_connect(conn); end); + conn:hook("binding-success", function () conn:debug("Connected: "..tostring(conn)); return on_connect(conn); end); conn:hook("binding-failure", function (err) - io.stderr:write("Authentication failure (",err.condition or "unknown error", ")", err.text and (": "..err.text) or "", "\n"); + conn:error("Resource binding failure ("..(err.condition or "unknown error")..")"..(err.text and (": "..err.text) or "")); end); conn:hook("disconnected", function (info) if info.reason then - io.stderr:write("Disconnecting: ", tostring(info.reason), "\n"); + conn:warn("Disconnecting: %s", tostring(info.reason)); end verse.quit(); end);