Module: Balotelli::Core::IrcLogger::Methods

Defined in:
lib/balotelli/core/irc_logger.rb

Instance Method Summary collapse

Instance Method Details

#sgetsObject



48
49
50
51
52
53
54
55
56
# File 'lib/balotelli/core/irc_logger.rb', line 48

def sgets
  str = orig_sgets
  to_log = "<<#{str.inspect}\n"
  @log_file.info(to_log)
  if str =~ /\A:?\S+ \S+ (#\S+) .*/
    @logger.channel_log(Regexp.last_match(1).downcase, to_log)
  end
  str
end

#sputs(str) ⇒ Object



58
59
60
61
62
63
64
65
66
# File 'lib/balotelli/core/irc_logger.rb', line 58

def sputs(str)
  orig_sputs(str)
  to_log = ">>#{str.inspect}\n"
  @log_file.info(to_log)
  if str =~ /\A:?\S+ (#\S+) .*/
    @logger.channel_log(Regexp.last_match(1).downcase, to_log)
  end
  str
end