cinchrb / cinch

The IRC Bot Building Framework
http://www.rubydoc.info/gems/cinch
MIT License
1k stars 180 forks source link

fatal logging doesn't #141

Open hickey opened 10 years ago

hickey commented 10 years ago

When attempting to use the built in logger with a fatal message, the following errors get produced:

[2013/09/09 03:14:17.584] !! /Users/ghickey/.rvm/gems/ruby-1.9.3-p327/gems/cinch-2.0.7/lib/cinch/logger.rb:133:in `format_message': undefined method `format_fatal' for #<Cinch::Logger::FormattedLogger:0x007fc1f2036bf8> (NoMethodError)
[2013/09/09 03:14:17.584] !!    /Users/ghickey/.rvm/gems/ruby-1.9.3-p327/gems/cinch-2.0.7/lib/cinch/logger.rb:115:in `block (2 levels) in log'
[2013/09/09 03:14:17.584] !!    /Users/ghickey/.rvm/gems/ruby-1.9.3-p327/gems/cinch-2.0.7/lib/cinch/logger.rb:113:in `each'
[2013/09/09 03:14:17.584] !!    /Users/ghickey/.rvm/gems/ruby-1.9.3-p327/gems/cinch-2.0.7/lib/cinch/logger.rb:113:in `block in log'
[2013/09/09 03:14:17.584] !!    <internal:prelude>:10:in `synchronize'
[2013/09/09 03:14:17.584] !!    /Users/ghickey/.rvm/gems/ruby-1.9.3-p327/gems/cinch-2.0.7/lib/cinch/logger.rb:112:in `log'
[2013/09/09 03:14:17.584] !!    /Users/ghickey/.rvm/gems/ruby-1.9.3-p327/gems/cinch-2.0.7/lib/cinch/logger_list.rb:19:in `block in log'
[2013/09/09 03:14:17.584] !!    /Users/ghickey/.rvm/gems/ruby-1.9.3-p327/gems/cinch-2.0.7/lib/cinch/logger_list.rb:19:in `each'
[2013/09/09 03:14:17.584] !!    /Users/ghickey/.rvm/gems/ruby-1.9.3-p327/gems/cinch-2.0.7/lib/cinch/logger_list.rb:19:in `log'
[2013/09/09 03:14:17.584] !!    /Users/ghickey/.rvm/gems/ruby-1.9.3-p327/gems/cinch-2.0.7/lib/cinch/helpers.rb:135:in `log'
[2013/09/09 03:14:17.585] !!    /Users/ghickey/.rvm/gems/ruby-1.9.3-p327/gems/cinch-2.0.7/lib/cinch/helpers.rb:150:in `fatal'
[2013/09/09 03:14:17.585] !!    /Volumes/ebay-Projects/sobot/plugins/pid_file.rb:59:in `create_pidfile'
[2013/09/09 03:14:17.585] !!    /Users/ghickey/.rvm/gems/ruby-1.9.3-p327/gems/cinch-2.0.7/lib/cinch/plugin.rb:318:in `block (2 levels) in __register_listeners'
[2013/09/09 03:14:17.585] !!    /Users/ghickey/.rvm/gems/ruby-1.9.3-p327/gems/cinch-2.0.7/lib/cinch/handler.rb:88:in `call'
[2013/09/09 03:14:17.585] !!    /Users/ghickey/.rvm/gems/ruby-1.9.3-p327/gems/cinch-2.0.7/lib/cinch/handler.rb:88:in `block in call'

Further testing gives the following results:

debug: works as expected -- [2013/09/09 03:30:42.132] !! [Cinch::PidFile] This is debug info: works as expected -- [2013/09/09 03:30:42.134] II [Cinch::PidFile] This is info warn: message get printed as a debug message -- [2013/09/09 03:30:42.135] !! [Cinch::PidFile] This is warn error: no logging decorations, just the message -- [Cinch::PidFile] This is error

exception is probably working given that fatal is throwing an exception and the above output displays it (with red !!)

hickey commented 10 years ago

Also it would really be great if abort really complained loudly so that the message did not mix in with the other messages. Currently it acts much like error where just the text is printed.

dominikh commented 10 years ago

What is abort? Did you mean fatal?