Class: Neovim::Logging::Json

Inherits:
Stream show all
Defined in:
lib/neovim/logging.rb

Constant Summary collapse

NAME =
"json"

Constants inherited from Logger

Logger::SUBS

Instance Method Summary collapse

Methods inherited from Stream

open

Methods inherited from Logger

inherited, provide

Constructor Details

#initialize(file) ⇒ Json

Returns a new instance of Json.



186
187
188
189
190
# File 'lib/neovim/logging.rb', line 186

def initialize file
  super
  require "json"
  require "time"
end

Instance Method Details

#put(**fields) ⇒ Object



191
192
193
194
195
# File 'lib/neovim/logging.rb', line 191

def put **fields
  fields[ :time] = fields[ :time].iso8601 rescue nil
  @file.puts fields.to_json
  @file.flush
end