Comparison

clix.lua @ 7:6078e8d2b59d

clix: Enable global Verse logger when verbose is enabled
author Matthew Wild <mwild1@gmail.com>
date Thu, 07 Jan 2010 02:05:16 +0000
parent 5:7209e1f8e66b
child 8:df4cb4a73549
comparison
equal deleted inserted replaced
6:0ec2fd06a962 7:6078e8d2b59d
55 local account = accounts[opts.account or "default"]; 55 local account = accounts[opts.account or "default"];
56 if not (account and account.jid) then 56 if not (account and account.jid) then
57 io.stderr:write("The specified account (", opts.account or "default", ") wasn't found in the config file\n"); 57 io.stderr:write("The specified account (", opts.account or "default", ") wasn't found in the config file\n");
58 return nil; 58 return nil;
59 end 59 end
60 verse.set_logger(function () end); 60 verse.set_logger(opts.verbose and print or function () end);
61 local conn = verse.new(verse.logger()); 61 local conn = verse.new(verse.logger());
62 conn.log.debug = opts.verbose; 62 conn.log.debug = opts.verbose;
63 conn:hook("authentication-failure", function (err) 63 conn:hook("authentication-failure", function (err)
64 conn:error("Authentication failure ("..(err.condition or "unknown error")..")"..(err.text and (": "..err.text) or "")); 64 conn:error("Authentication failure ("..(err.condition or "unknown error")..")"..(err.text and (": "..err.text) or ""));
65 end); 65 end);