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.



181
182
183
184
185
# File 'lib/neovim/logging.rb', line 181

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

Instance Method Details

#put(**fields) ⇒ Object



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

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