use conditional assignment

This commit is contained in:
onyx-and-iris 2023-08-06 11:30:37 +01:00
parent 7d25662191
commit f9bf8e59e0

View File

@ -3,7 +3,7 @@ require "logger"
module Voicemeeter module Voicemeeter
module Logging module Logging
def logger def logger
@logger = Logger.new($stdout, level: ENV.fetch("VM_LOG_LEVEL", "WARN")) @logger ||= Logger.new($stdout, level: ENV.fetch("VM_LOG_LEVEL", "WARN"))
@logger.progname = instance_of?(::Module) ? name : self.class.name @logger.progname = instance_of?(::Module) ? name : self.class.name
@logger @logger
end end