Class: Forklift::Base::Logger
- Inherits:
-
Object
- Object
- Forklift::Base::Logger
- Defined in:
- lib/forklift/base/logger.rb
Instance Method Summary collapse
- #debug(message) ⇒ Object
- #emphatically(message) ⇒ Object
- #fatal(message) ⇒ Object
- #forklift ⇒ Object
-
#initialize(forklift) ⇒ Logger
constructor
A new instance of Logger.
- #log(message, severity = "info") ⇒ Object
- #logger ⇒ Object
- #messages ⇒ Object
Constructor Details
#initialize(forklift) ⇒ Logger
Returns a new instance of Logger.
7 8 9 |
# File 'lib/forklift/base/logger.rb', line 7 def initialize(forklift) @forklift = forklift end |
Instance Method Details
#debug(message) ⇒ Object
31 32 33 34 35 |
# File 'lib/forklift/base/logger.rb', line 31 def debug() if forklift.config[:logger][:debug] == true log("[debug] #{}") end end |
#emphatically(message) ⇒ Object
37 38 39 40 41 |
# File 'lib/forklift/base/logger.rb', line 37 def emphatically() log "" if .length > 0 log "*** #{} ***" log "" end |
#fatal(message) ⇒ Object
43 44 45 |
# File 'lib/forklift/base/logger.rb', line 43 def fatal() log "!!! #{} !!!" end |
#forklift ⇒ Object
11 12 13 |
# File 'lib/forklift/base/logger.rb', line 11 def forklift @forklift end |
#log(message, severity = "info") ⇒ Object
24 25 26 27 28 29 |
# File 'lib/forklift/base/logger.rb', line 24 def log(, severity="info") = "[Forklift @ #{Time.now}] #{}" puts unless forklift.config[:logger][:stdout] != true logger.send(severity.to_sym, ) unless logger.nil? << end |
#logger ⇒ Object
19 20 21 22 |
# File 'lib/forklift/base/logger.rb', line 19 def logger log_dir = "#{forklift.config[:project_root]}/log" @logger ||= ::Lumberjack::Logger.new("#{log_dir}/forklift.log", buffer_size: 0) end |
#messages ⇒ Object
15 16 17 |
# File 'lib/forklift/base/logger.rb', line 15 def @messages ||= [] end |