class LoggerBase
Public Instance Methods
log_error(message)
click to toggle source
# File lib/logging/logger_base.rb, line 28 def log_error(message) log "" log "******** ERROR ********" log "An error has occurred:" log "#{message}" log "***********************" log "" end
message_box(msg, mtype = "sep")
click to toggle source
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
# File lib/logging/logger_base.rb, line 8 def message_box(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