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.
Defined Under Namespace
Modules: Helpers
Class Attribute Summary collapse
-
.logger ⇒ Object
Return the value of @logger, or construct it from the environment.
Class Method Summary collapse
Class Attribute Details
.logger ⇒ Object
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
)
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/neovim/logging.rb', line 13 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
35 36 37 |
# File 'lib/neovim/logging.rb', line 35 def self.included(base) base.send(:include, Helpers) end |