33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/neovim/logging.rb', line 33
def provide str
opened = nil
args = str.to_s.split ":"
args.each { |a| a.gsub! %r/%(\h\h)/ do ($1.to_i 0x10).chr end }
cls =
if args.first =~ /\A\w+\z/ then
prot = args.shift
(SUBS.find { |s| s::NAME == prot rescue nil }) or raise "Logger not found: #{str}"
else
Text
end
dest = args.shift
cls.open dest, **(parse_arguments args) do |i|
opened = true
yield i
end
rescue raise unless not opened and str.notempty?
$stderr.puts "Failed to open log file '#{str}'. Logging to stderr."
str = nil
retry
end
|