lib/protonbot/log.rb in protonbot-0.1.0 vs lib/protonbot/log.rb in protonbot-0.1.1
- old
+ new
@@ -2,11 +2,11 @@
# @!attribute [rw] levels
# @return [Hash<String>] Colorscheme
# @!attribute [rw] logging
# @return [Bool] If false, does not write messages.
class ProtonBot::Log
- attr_accessor :levels, :logging
+ attr_accessor :levels, :logging, :log_info
def initialize
@pastel = Pastel.new
@queue = Queue.new
@@ -15,10 +15,11 @@
@dfmt = '%d.%m.%Y'
@tfmt = '%H:%M:%S'
@levels = DEFAULT_SCHEME
@logging = true
+ @log_info = false
@stop = false
lloop
end
@@ -33,12 +34,14 @@
# @!group Logging
# @param msg [String]
# @param nam [String] Name
def info(msg, nam = 'log')
- dat = gsub(msg.to_s, :info, nam)
- @queue << dat
- @pastel.strip(dat)
+ if @log_info
+ dat = gsub(msg.to_s, :info, nam)
+ @queue << dat
+ @pastel.strip(dat)
+ end
end
# @param msg [String]
# @param nam [String] Name
def debug(msg, nam = 'log')