Include exception logger and attach to all available methods

This commit is contained in:
sophia 2022-01-05 14:54:57 -06:00 committed by Paul Hinze
parent 914530d26a
commit 441f82760b
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
6 changed files with 7 additions and 7 deletions

View File

@ -11,7 +11,7 @@ module VagrantPlugins
klass.prepend(Util::HasMapper)
klass.prepend(Util::HasBroker)
klass.prepend(Util::HasLogger)
klass.prepend(Util::ExceptionLogger)
klass.include(Util::ExceptionLogger)
klass.class_eval do
attr_reader :capabilities, :default_args

View File

@ -10,7 +10,7 @@ module VagrantPlugins
prepend Util::HasMapper
prepend Util::HasBroker
prepend Util::HasLogger
prepend Util::ExceptionLogger
include Util::ExceptionLogger
def command_info_spec(*args)
SDK::FuncSpec.new

View File

@ -8,9 +8,9 @@ module VagrantPlugins
prepend Util::HasMapper
prepend Util::HasBroker
prepend Util::ExceptionLogger
prepend Util::HasLogger
include Util::HasSeeds::Service
include Util::ExceptionLogger
def initialize(*args, **opts, &block)
super()

View File

@ -12,7 +12,7 @@ module VagrantPlugins
class InternalService < Hashicorp::Vagrant::RubyVagrant::Service
prepend Util::HasBroker
prepend Util::HasLogger
prepend Util::ExceptionLogger
include Util::ExceptionLogger
def get_plugins(req, _unused_call)
plugins = []

View File

@ -12,7 +12,7 @@ module VagrantPlugins
prepend Util::HasMapper
prepend Util::HasBroker
prepend Util::HasLogger
prepend Util::ExceptionLogger
include Util::ExceptionLogger
def usable(req, _unused_call)
nil

View File

@ -3,8 +3,8 @@ module VagrantPlugins
module Util
# Adds exception logging to all public instance methods
module ExceptionLogger
def self.prepended(klass)
klass.public_instance_methods(false).each do |m_name|
def self.included(klass)
klass.public_instance_methods.each do |m_name|
klass.define_method(m_name) do |*args, **opts, &block|
begin
super(*args, **opts, &block)