Class: Neovim::Logging::Stream
Constant Summary
Constants inherited from Logger
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(file, **kwargs) ⇒ Stream
constructor
A new instance of Stream.
Methods inherited from Logger
Constructor Details
#initialize(file, **kwargs) ⇒ Stream
Returns a new instance of Stream.
120 121 122 |
# File 'lib/neovim/logging.rb', line 120 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 113 114 115 116 117 |
# 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 unless path =~ /\A(?:\.\/|~|\/)/ then require "neovim/connection" base = ConnectionChild.stdpath "log" end path = File. path, base File.open path, "a", **params do |f| yield (new f, **kwargs) end else yield (new $stderr, **kwargs) end end |