Class: MachineLearningWorkbench::Tools::Logging::LogSplitter

Inherits:
File
  • Object
show all
Defined in:
lib/machine_learning_workbench/tools/logging.rb

Overview

Splits calls to standard streams to be both displayed on terminal and saved to file

Instance Method Summary collapse

Constructor Details

#initialize(dest) ⇒ LogSplitter

Returns a new instance of LogSplitter.



7
8
9
10
11
12
13
# File 'lib/machine_learning_workbench/tools/logging.rb', line 7

def initialize dest
  fname = if File.directory?(dest)
    "#{dest}/#{Time.now.strftime "%y%m%d_%H%M"}.log"
  else dest
  end
  super fname, 'w'
end

Instance Method Details

#write(*args) ⇒ Object



15
16
17
18
# File 'lib/machine_learning_workbench/tools/logging.rb', line 15

def write *args
  STDOUT.write *args
  super
end