From 0dcefddae4db4a9dbd70176a455316a2c881819c Mon Sep 17 00:00:00 2001 From: sophia Date: Wed, 5 Jan 2022 16:12:02 -0600 Subject: [PATCH] Only add exception logger to non-generic methods --- plugins/commands/serve/util/exception_logger.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/commands/serve/util/exception_logger.rb b/plugins/commands/serve/util/exception_logger.rb index a8790020f..15c7d5222 100644 --- a/plugins/commands/serve/util/exception_logger.rb +++ b/plugins/commands/serve/util/exception_logger.rb @@ -4,7 +4,13 @@ module VagrantPlugins # Adds exception logging to all public instance methods module ExceptionLogger def self.included(klass) - klass.public_instance_methods.each do |m_name| + # Get all the public instance methods. Need to search ancestors as well + # for modules like the Guest service which includes the CapabilityPlatform + # module + klass_public_instance_methods = klass.public_instance_methods + # Remove all generic instance methods from the list of ones to modify + logged_methods = klass_public_instance_methods - Object.public_instance_methods + logged_methods.each do |m_name| klass.define_method(m_name) do |*args, **opts, &block| begin super(*args, **opts, &block)