Merge pull request #20481 from Homebrew/dug/typed-ologger
Type remaining Kernel logging extensions
This commit is contained in:
commit
4ae4bd491a
@ -148,6 +148,11 @@ class AbstractDownloadStrategy
|
||||
cached_location.basename
|
||||
end
|
||||
|
||||
sig { override.params(title: T.any(String, Exception), sput: T.anything).void }
|
||||
def ohai(title, *sput)
|
||||
super unless quiet?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
sig { params(args: T.anything).void }
|
||||
@ -155,11 +160,6 @@ class AbstractDownloadStrategy
|
||||
super unless quiet?
|
||||
end
|
||||
|
||||
sig { params(args: T.anything).void }
|
||||
def ohai(*args)
|
||||
super unless quiet?
|
||||
end
|
||||
|
||||
sig { params(args: String, options: T.untyped).returns(SystemCommand::Result) }
|
||||
def silent_command(*args, **options)
|
||||
system_command(*args, print_stderr: false, env:, **options)
|
||||
|
@ -44,11 +44,13 @@ module Kernel
|
||||
Formatter.headline(title, color: :blue)
|
||||
end
|
||||
|
||||
sig { params(title: T.any(String, Exception), sput: T.anything).void }
|
||||
def ohai(title, *sput)
|
||||
puts ohai_title(title.to_s)
|
||||
puts sput
|
||||
end
|
||||
|
||||
sig { params(title: T.any(String, Exception), sput: T.anything, always_display: T::Boolean).void }
|
||||
def odebug(title, *sput, always_display: false)
|
||||
debug = if respond_to?(:debug)
|
||||
T.unsafe(self).debug?
|
||||
|
@ -60,6 +60,7 @@ class FormulaVersions
|
||||
# We rescue these so that we can skip bad versions and
|
||||
# continue walking the history
|
||||
odebug "#{e} in #{name} at revision #{revision}", Utils::Backtrace.clean(e)
|
||||
nil
|
||||
rescue FormulaUnavailableError
|
||||
nil
|
||||
ensure
|
||||
|
@ -4,7 +4,7 @@
|
||||
# A {Messages} object collects messages that may need to be displayed together
|
||||
# at the end of a multi-step `brew` command run.
|
||||
class Messages
|
||||
sig { returns(T::Array[T::Hash[Symbol, Symbol]]) }
|
||||
sig { returns(T::Array[{ package: String, caveats: T.any(String, Caveats) }]) }
|
||||
attr_reader :caveats
|
||||
|
||||
sig { returns(Integer) }
|
||||
@ -15,7 +15,7 @@ class Messages
|
||||
|
||||
sig { void }
|
||||
def initialize
|
||||
@caveats = T.let([], T::Array[T::Hash[Symbol, Symbol]])
|
||||
@caveats = T.let([], T::Array[{ package: String, caveats: T.any(String, Caveats) }])
|
||||
@completions_and_elisp = T.let(Set.new, T::Set[String])
|
||||
@package_count = T.let(0, Integer)
|
||||
@install_times = T.let([], T::Array[T::Hash[String, Float]])
|
||||
@ -53,7 +53,7 @@ class Messages
|
||||
return if @package_count == 1 && !force
|
||||
|
||||
oh1 "Caveats" if @completions_and_elisp.empty?
|
||||
@caveats.each { |c| ohai c[:package], c[:caveats] }
|
||||
@caveats.each { |c| ohai c.fetch(:package), c.fetch(:caveats) }
|
||||
end
|
||||
|
||||
sig { void }
|
||||
|
@ -24,7 +24,7 @@ module Repology
|
||||
if Homebrew::EnvConfig.developer?
|
||||
$stderr.puts result&.stderr
|
||||
else
|
||||
odebug result&.stderr
|
||||
odebug result&.stderr.to_s
|
||||
end
|
||||
|
||||
raise
|
||||
|
Loading…
x
Reference in New Issue
Block a user