Module: SqlChatbot::Grammar::MissLogger

Defined in:
lib/sql_chatbot/grammar/miss_logger.rb

Class Method Summary collapse

Class Method Details

.log(log_path, entry) ⇒ Object



10
11
12
13
14
# File 'lib/sql_chatbot/grammar/miss_logger.rb', line 10

def self.log(log_path, entry)
  FileUtils.mkdir_p(File.dirname(log_path))
  line = JSON.generate({ ts: Time.now.utc.iso8601 }.merge(entry)) + "\n"
  File.open(log_path, "a") { |f| f.write(line) }
end