From c789fbf440b13232daa3a183bdfdaff1d55f1a17 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Mon, 9 Sep 2019 20:31:26 -0700 Subject: [PATCH] Set GRPC to use our logger --- lib/vagrant/go_plugin/interface.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/vagrant/go_plugin/interface.rb b/lib/vagrant/go_plugin/interface.rb index a511519e9..4cf9d36b0 100644 --- a/lib/vagrant/go_plugin/interface.rb +++ b/lib/vagrant/go_plugin/interface.rb @@ -1,6 +1,17 @@ require "log4r" require "vagrant/go_plugin/core" +require "vagrant/go_plugin/vagrant_proto/vagrant_services_pb" + +module RubyLogger + include Vagrant::Util::Logger +end + +module GRPC + extend Vagrant::Util::Logger +end + + module Vagrant module GoPlugin # Interface for go-plugin integration @@ -15,11 +26,15 @@ module Vagrant attach_function :_setup, :Setup, [:enable_logger, :timestamps, :log_level], :bool attach_function :_teardown, :Teardown, [], :void + attach_function :_reset, :Reset, [], :void attach_function :_load_plugins, :LoadPlugins, [:plugin_directory], :bool attach_function :_list_providers, :ListProviders, [], :plugin_result attach_function :_list_synced_folders, :ListSyncedFolders, [], :plugin_result def initialize + Vagrant::Proto.instance_eval do + ::GRPC.extend(Vagrant::Util::Logger) + end setup end @@ -72,6 +87,12 @@ module Vagrant end end + def reset + logger.debug("running go-plugin interface reset") + _reset + logger.debug("completed go-plugin interface reset") + end + # Teardown any plugins that may be currently active def teardown logger.debug("starting teardown of go-plugin interface")