Class: Awsom::CustomLogger
- Inherits:
-
Logger
- Object
- Logger
- Awsom::CustomLogger
- Defined in:
- lib/awsom/custom_logger.rb
Instance Attribute Summary collapse
-
#trace ⇒ Object
writeonly
Sets the attribute trace.
Instance Method Summary collapse
- #bullet(msg) ⇒ Object
- #format_message(severity, timestamp, progname, msg) ⇒ Object
-
#initialize(file) ⇒ CustomLogger
constructor
A new instance of CustomLogger.
- #trace? ⇒ Boolean
Constructor Details
#initialize(file) ⇒ CustomLogger
Returns a new instance of CustomLogger.
7 8 9 10 |
# File 'lib/awsom/custom_logger.rb', line 7 def initialize(file) super(file) @level = ::Logger::INFO end |
Instance Attribute Details
#trace=(value) ⇒ Object (writeonly)
Sets the attribute trace
5 6 7 |
# File 'lib/awsom/custom_logger.rb', line 5 def trace=(value) @trace = value end |
Instance Method Details
#bullet(msg) ⇒ Object
25 26 27 |
# File 'lib/awsom/custom_logger.rb', line 25 def bullet(msg) puts "#{"\u2219".bold.blue} #{msg}" end |
#format_message(severity, timestamp, progname, msg) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/awsom/custom_logger.rb', line 12 def (severity, , progname, msg) case severity when "INFO" "#{msg}\n" when "ERROR" "#{severity.bold.red} #{msg}\n" when "WARN" "#{severity.downcase.bold.yellow} #{msg}\n" else "#{severity[0].bold.blue} #{msg}\n" end end |
#trace? ⇒ Boolean
29 30 31 |
# File 'lib/awsom/custom_logger.rb', line 29 def trace? @trace end |