module Autoshell::Log
Mixin for handling log stuff
Attributes
logger[W]
Public Instance Methods
log_output(color: false)
click to toggle source
Get the complete output of the log @return [String] log contents
# File lib/autoshell/log.rb, line 29 def log_output(color: false) return unless defined? @log_device if color @log_device.string else ANSI.unansi(@log_device.string) end end
log_reset()
click to toggle source
Reset the log contents @return self
# File lib/autoshell/log.rb, line 40 def log_reset @log_device.truncate(0) if defined? @log_device self end
logger()
click to toggle source
Instance-specific logger
shell = Autoshell.new '~/test' shell.logger shell.logger = Rails.logger
@return [Logger] logger instance
# File lib/autoshell/log.rb, line 16 def logger return @logger if defined? @logger @log_device = StringIO.new @logger = Logger.new(@log_device) @logger.level = LOG_LEVEL @logger.formatter = LOG_FORMATTER @logger end