Class: PointLogger
- Inherits:
-
Object
- Object
- PointLogger
- Defined in:
- lib/pointlogger.rb
Instance Method Summary collapse
-
#info(message) ⇒ Object
Basic log levels methods.
-
#initialize(name, log_format) ⇒ PointLogger
constructor
A new instance of PointLogger.
-
#log(level, message) ⇒ Object
Log a message into the console.
- #severe(message) ⇒ Object
- #warning(message) ⇒ Object
Constructor Details
#initialize(name, log_format) ⇒ PointLogger
Returns a new instance of PointLogger.
5 6 7 8 9 10 11 |
# File 'lib/pointlogger.rb', line 5 def initialize (name, log_format) @name = name @format = log_format time = Time.new @format["${TIME}"] = time.hour.inspect + ":" + time.min.inspect + ":" + time.sec.inspect @format["${NAME}"] = @name end |
Instance Method Details
#info(message) ⇒ Object
Basic log levels methods
22 23 24 |
# File 'lib/pointlogger.rb', line 22 def info log(LogLevel::INFO, ) end |
#log(level, message) ⇒ Object
Log a message into the console
14 15 16 17 18 19 |
# File 'lib/pointlogger.rb', line 14 def log(level, ) @format["${LEVEL}"] = level.name @format["${MESSAGE}"] = puts @format end |
#severe(message) ⇒ Object
30 31 32 |
# File 'lib/pointlogger.rb', line 30 def severe log(LogLevel::SEVERE, ) end |
#warning(message) ⇒ Object
26 27 28 |
# File 'lib/pointlogger.rb', line 26 def warning log(LogLevel::WARNING, ) end |