From d4d1391bbbf167f46599c274aa6a8b42d87fb0d0 Mon Sep 17 00:00:00 2001 From: Adam Luikart Date: Mon, 7 Apr 2014 17:34:26 -0500 Subject: [PATCH] Don't hang on to the first Logger instance you see If the main app instance hangs on to the logger that ::Middleman::Logger.singleton returns, then subsequent calls to re-init the logger won't have any effect (for instance, when setting up the preview server's logger based on CLI params). Redefining logger to be a pass-through to ::Middleman::Logger.singleton instead of an ivar seems more in keeping with the sprit of a singleton, anyways. This fixes an issue where running `middleman server --verbose` doesn't output any debug info. --- middleman-core/lib/middleman-core/application.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/middleman-core/lib/middleman-core/application.rb b/middleman-core/lib/middleman-core/application.rb index 8c2c9352..91eab8c7 100644 --- a/middleman-core/lib/middleman-core/application.rb +++ b/middleman-core/lib/middleman-core/application.rb @@ -149,7 +149,9 @@ module Middleman include Middleman::CoreExtensions::ExternalHelpers # Reference to Logger singleton - attr_reader :logger + def logger + ::Middleman::Logger.singleton + end # New container for config.rb commands attr_reader :config_context @@ -167,7 +169,6 @@ module Middleman # Initialize the Middleman project def initialize(&block) - @logger = ::Middleman::Logger.singleton @template_context_class = Class.new(Middleman::TemplateContext) @generic_template_context = @template_context_class.new(self) @config_context = ConfigContext.new(self, @template_context_class)