gems.ruby_dep-1.5.0.lib.ruby_dep.logger.rb Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sass-maven-plugin Show documentation
Show all versions of sass-maven-plugin Show documentation
A Maven Plugin that compiles Sass files.
require 'logger'
module RubyDep
def self.logger
@logger ||= stderr_logger
end
def self.logger=(new_logger)
@logger = new_logger.nil? ? NullLogger.new : new_logger
end
def self.stderr_logger
::Logger.new(STDERR).tap do |logger|
logger.formatter = proc { |_,_,_,msg| "#{msg}\n" }
end
end
# Shamelessly stolen from https://github.com/karafka/null-logger
class NullLogger
LOG_LEVELS = %w(unknown fatal error warn info debug).freeze
def respond_to_missing?(method_name, include_private = false)
LOG_LEVELS.include?(method_name.to_s) || super
end
def method_missing(method_name, *args, &block)
LOG_LEVELS.include?(method_name.to_s) ? nil : super
end
end
# TODO: not used, but kept for the sake of SemVer
# TODO: remove in next major version
class Logger
def initialize(device, prefix)
@device = device
@prefix = prefix
::RubyDep.logger.warn("The RubyDep::Logger class is deprecated")
end
def warning(msg)
@device.puts @prefix + msg
end
def notice(msg)
@device.puts @prefix + msg
end
end
end
© 2015 - 2025 Weber Informatics LLC | Privacy Policy