aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/irc.rb1
-rw-r--r--core/logger.rb26
2 files changed, 12 insertions, 15 deletions
diff --git a/core/irc.rb b/core/irc.rb
index 0cde75d..fdb2ad7 100644
--- a/core/irc.rb
+++ b/core/irc.rb
@@ -35,6 +35,7 @@ module Dinobot
def gets
str = @socket.gets
+ str.chomp! unless str.nil?
@logger.in str.inspect
diff --git a/core/logger.rb b/core/logger.rb
index d73cd15..086967c 100644
--- a/core/logger.rb
+++ b/core/logger.rb
@@ -5,33 +5,29 @@ module Dinobot
@@mutex = Mutex.new
def in(*lines)
- str = lines.join("\n")
-
- puts str.gsub(/^/, "\e[32m<<\e[0m ")
+ pout("\e[32m<<\e[0m ", *lines)
end
def out(*lines)
- str = lines.join("\n")
+ pout("\e[36m>>\e[0m ", *lines)
+ end
- puts str.gsub(/^/, "\e[36m>>\e[0m ")
+ def info(*lines)
+ pout("\e[33m==\e[0m ", *lines)
end
def error(*lines)
- str = lines.join("\n")
-
- puts str.gsub(/^/, "\e[31m!!\e[0m ")
+ pout("\e[31m!!\e[0m ", *lines)
end
- def info(*lines)
- str = lines.join("\n")
-
- puts str.gsub(/^/, "\e[33m==\e[0m ")
+ def indent(*lines)
+ pout(' ', *lines)
end
- def indent(*lines)
- str = lines.join("\n")
+ private
- puts str.gsub(/^/, ' ')
+ def pout(prefix, *lines)
+ puts lines.join("\n").gsub(/^/, prefix)
end
class << self