Class: Neovim::Logging::Stream

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

Direct Known Subclasses

Json, Plain, Text

Constant Summary

Constants inherited from Logger

Logger::SUBS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Logger

inherited, provide

Constructor Details

#initialize(file, **kwargs) ⇒ Stream

Returns a new instance of Stream.



115
116
117
# File 'lib/neovim/logging.rb', line 115

def initialize file, **kwargs
  @file = file
end

Class Method Details

.open(path = nil, **kwargs) ⇒ Object



99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/neovim/logging.rb', line 99

def open path = nil, **kwargs
  if path.notempty? and path != "-" then
    params = {}
    %i(external_encoding newline).each do |k|
      v = kwargs.delete k
      params[ k] = v if v
    end
    File.open path, "a", **params do |f|
      yield (new f, **kwargs)
    end
  else
    yield (new $stderr, **kwargs)
  end
end