Class: Lapidarist::Logger
- Inherits:
-
Object
- Object
- Lapidarist::Logger
- Defined in:
- lib/lapidarist/logger.rb
Instance Method Summary collapse
- #debug(message, label = nil) ⇒ Object
- #footer(message) ⇒ Object
- #header(message) ⇒ Object
- #info(message, level = 0) ⇒ Object
- #setup ⇒ Object
- #smart_header(message) ⇒ Object
- #std_out_err(message, command) ⇒ Object
- #summary(message) ⇒ Object
Instance Method Details
#debug(message, label = nil) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/lapidarist/logger.rb', line 24 def debug(, label = nil) return unless Lapidarist.config.debug if label puts " DEBUG (#{label}) > #{message}" else puts " DEBUG > #{message}" end end |
#footer(message) ⇒ Object
16 17 18 |
# File 'lib/lapidarist/logger.rb', line 16 def () write "... #{message}", 0 end |
#header(message) ⇒ Object
3 4 5 6 |
# File 'lib/lapidarist/logger.rb', line 3 def header() write '', 0 write "#{message} ...", 0 end |
#info(message, level = 0) ⇒ Object
20 21 22 |
# File 'lib/lapidarist/logger.rb', line 20 def info(, level = 0) write , level end |
#setup ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/lapidarist/logger.rb', line 38 def setup if Lapidarist.config.log_path && !Lapidarist.config.log_path.empty? Open3.capture2("mkdir -p #{Lapidarist.config.log_path.dirname}", chdir: Lapidarist.config.directory) Open3.capture2("touch #{Lapidarist.config.log_path}", chdir: Lapidarist.config.directory) clear_log_file end end |
#smart_header(message) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/lapidarist/logger.rb', line 8 def smart_header() if Lapidarist.config.verbosity > 0 header() else info(, 0) end end |
#std_out_err(message, command) ⇒ Object
34 35 36 |
# File 'lib/lapidarist/logger.rb', line 34 def std_out_err(, command) write "OUT_ERR (#{command}) > #{message.strip}", 2 end |
#summary(message) ⇒ Object
46 47 48 49 |
# File 'lib/lapidarist/logger.rb', line 46 def summary() write_std_out(, 0) write_log_file() end |