Module: Neovim::Logging

Included in:
AsyncSession, EventLoop, Host, Manifest, MsgpackStream
Defined in:
lib/neovim/logging.rb

Overview

Mixed into classes for unified logging helper methods.

Class Attribute Summary collapse

Class Attribute Details

.loggerObject

Return the value of @logger, or construct it from the environment. $NVIM_RUBY_LOG_FILE specifies a file to log to (default STDOUT), while NVIM_RUBY_LOG_LEVEL specifies the level (default WARN)



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/neovim/logging.rb', line 14

def self.logger
  return @logger if instance_variable_defined?(:@logger)

  if ENV["NVIM_RUBY_LOG_FILE"]
    @logger = Logger.new(ENV["NVIM_RUBY_LOG_FILE"])
  else
    @logger = Logger.new(STDERR)
  end

  if ENV["NVIM_RUBY_LOG_LEVEL"]
    @logger.level = Integer(ENV["NVIM_RUBY_LOG_LEVEL"])
  else
    @logger.level = Logger::WARN
  end

  @logger
end