Class: LoggerBase
- Inherits:
-
Object
- Object
- LoggerBase
- Defined in:
- lib/logging/logger_base.rb
Direct Known Subclasses
Instance Method Summary collapse
- #log_error(message) ⇒ Object
-
#message_box(msg, mtype = "sep") ⇒ Object
Provides a pretty box for titles.
Instance Method Details
#log_error(message) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/logging/logger_base.rb', line 28 def log_error() log "" log "******** ERROR ********" log "An error has occurred" log "#{}" log "***********************" log "" end |
#message_box(msg, mtype = "sep") ⇒ Object
Provides a pretty box for titles
Attributes
-
msg
- the text to output -
mtype
- box type to display sep: a separator line, title a box around the message
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/logging/logger_base.rb', line 8 def (msg, mtype = "sep") return "" if msg.nil? || msg.length < 1 tot = 72 msg = msg[0..64] if msg.length > 65 ilen = tot - msg.length if mtype == "sep" start = "##{"-" * (ilen/2).to_i} #{msg} " res = "#{start}#{"-" * (tot- start.length + 1)}#" else res = "##{"-" * tot}#\n" start = "##{" " * (ilen/2).to_i} #{msg} " res += "#{start}#{" " * (tot- start.length + 1)}#\n" res += "##{"-" * tot}#\n" end log(res) end |