Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/deis_deploy/strings.rb
Constant Summary collapse
- @@log_level =
add a log level value to string class for output handling 0 = fatal only 1 = fatal & warnings 2 = fatal, warnings & important 3 = fatal, warnings, important & info 4 = fatal, warnings, important, info & log
3
Class Method Summary collapse
Instance Method Summary collapse
- #fatal ⇒ Object
- #important ⇒ Object
- #info ⇒ Object
-
#log ⇒ Object
functions to output various log types.
- #warning ⇒ Object
Class Method Details
.log_level ⇒ Object
14 15 16 |
# File 'lib/deis_deploy/strings.rb', line 14 def self.log_level return @@log_level end |
.log_level=(lvl) ⇒ Object
17 18 19 |
# File 'lib/deis_deploy/strings.rb', line 17 def self.log_level=(lvl) @@log_level = lvl.to_i end |
Instance Method Details
#fatal ⇒ Object
48 49 50 51 52 |
# File 'lib/deis_deploy/strings.rb', line 48 def fatal if @@log_level >= 0 puts self.colorize(:background => :red, :color => :white) end end |
#important ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/deis_deploy/strings.rb', line 34 def important if @@log_level >= 2 puts "" puts self.colorize(:blue) puts "" end end |
#info ⇒ Object
28 29 30 31 32 |
# File 'lib/deis_deploy/strings.rb', line 28 def info if @@log_level >= 3 puts self.colorize(:green) end end |
#log ⇒ Object
functions to output various log types
22 23 24 25 26 |
# File 'lib/deis_deploy/strings.rb', line 22 def log if @@log_level >= 4 puts "\e[2m[#{Time.now}]: #{self}\e[22m" end end |
#warning ⇒ Object
42 43 44 45 46 |
# File 'lib/deis_deploy/strings.rb', line 42 def warning if @@log_level >= 1 puts self.colorize(:red) end end |