Module: Neovim::Logging Private

Included in:
Host, Session, Session::EventLoop, Session::RPC, Session::Serializer
Defined in:
lib/neovim/logging.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Mixed into classes for unified logging helper methods.

Defined Under Namespace

Modules: Helpers

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.loggerObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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
31
32
33
34
# File 'lib/neovim/logging.rb', line 14

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

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

  if env_level = ENV["NVIM_RUBY_LOG_LEVEL"]
    if Logger.const_defined?(env_level.upcase)
      @logger.level = Logger.const_get(env_level.upcase)
    else
      @logger.level = Integer(env_level)
    end
  else
    @logger.level = Logger::WARN
  end

  @logger
end

Class Method Details

.included(base) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



36
37
38
# File 'lib/neovim/logging.rb', line 36

def self.included(base)
  base.send(:include, Helpers)
end