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