Comparison

clix.lua @ 41:89070edde205

clix.lua: Use verse.logger() instead of print as the default logger
author Matthew Wild <mwild1@gmail.com>
date Wed, 15 Sep 2010 16:39:38 +0100
parent 40:c74380af7075
child 42:4f4fe532a889
comparison
equal deleted inserted replaced
40:c74380af7075 41:89070edde205
56 local account = accounts[opts.account or "default"]; 56 local account = accounts[opts.account or "default"];
57 if not (account and account.jid) then 57 if not (account and account.jid) then
58 io.stderr:write("The specified account (", opts.account or "default", ") wasn't found in the config file\n"); 58 io.stderr:write("The specified account (", opts.account or "default", ") wasn't found in the config file\n");
59 return nil; 59 return nil;
60 end 60 end
61 verse.set_logger(opts.verbose and print or function () end); 61 verse.set_logger(opts.verbose and verse.logger() or function () end);
62 local conn = verse.new(verse.logger()); 62 local conn = verse.new(verse.logger());
63 conn.log.debug = opts.verbose; 63 conn.log.debug = opts.verbose;
64 conn:hook("authentication-failure", function (err) 64 conn:hook("authentication-failure", function (err)
65 conn:error("Authentication failure ("..(err.condition or "unknown error")..")"..(err.text and (": "..err.text) or "")); 65 conn:error("Authentication failure ("..(err.condition or "unknown error")..")"..(err.text and (": "..err.text) or ""));
66 conn:close(); 66 conn:close();