Class: TP2::Logger
- Inherits:
-
Object
- Object
- TP2::Logger
- Defined in:
- lib/tp2/logger.rb
Instance Method Summary collapse
-
#initialize(machine, fd = STDOUT.fileno, **opts) ⇒ Logger
constructor
A new instance of Logger.
- #log(str) ⇒ Object
Constructor Details
#initialize(machine, fd = STDOUT.fileno, **opts) ⇒ Logger
Returns a new instance of Logger.
5 6 7 8 9 |
# File 'lib/tp2/logger.rb', line 5 def initialize(machine, fd = STDOUT.fileno, **opts) @machine = machine @fd = fd @opts = opts end |
Instance Method Details
#log(str) ⇒ Object
11 12 13 14 |
# File 'lib/tp2/logger.rb', line 11 def log(str) str = format("%s %s\n", Time.now.strftime('%Y-%m-%d %H:%M:%S.%3N'), str) @machine.write_async(@fd, str) end |