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

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

Instance Method Summary collapse

Instance Method Details

#sgetsObject



12
13
14
15
16
17
18
19
20
# File 'lib/balotelli/core/irc_logger.rb', line 12

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



22
23
24
25
26
27
28
29
30
# File 'lib/balotelli/core/irc_logger.rb', line 22

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