Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Config logger #1611

Merged
merged 3 commits into from
Aug 27, 2020
Merged

Config logger #1611

merged 3 commits into from
Aug 27, 2020

Conversation

gmcgibbon
Copy link
Member

@gmcgibbon gmcgibbon commented Aug 25, 2020

Description

Deprecates Quilt::Logger.log, adds more standard Quilt.logger.

This allows us to switch out test logger easily so running tests doesn't log anything. A lot of work for a small change, but this is a more standard method of logging for gems.

Type of change

  • quilt_rails Patch: Bug (non-breaking change which fixes an issue)
  • quilt_rails Minor: New feature (non-breaking change which adds functionality)
  • quilt_rails Major: Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have added a changelog entry, prefixed by the type of change noted above (Documentation fix and Test update does not need a changelog as we do not publish new version)

@@ -32,7 +32,7 @@ class UiController < ActionController::Base; end
boot_dummy

Rails.application.routes.draw do
mount(Quilt::Engine, at: '/quilt')
mount(::Quilt::Engine, at: '/quilt')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does the prefix :: mean?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QuiltRails::Quilt gets defined by a controller test, so :: makes sure the toplevel Quilt module gets referenced.

Copy link
Contributor

@michenly michenly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont know much about the code changes since it looks like mostly its convention changes?
But I did 🎩 and everything looks the same!

@@ -11,6 +11,7 @@ def initialize

self.react_server_host = "#{react_server_ip}:#{react_server_port}"
self.react_server_protocol = ENV['REACT_SERVER_PROTOCOL'] || "http"
self.logger = ::Logger.new($stdout)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks weird to me to set this logger inside the configuration. Quilt::Configuration.logger.log :/

Why not do like Rails and just set a class variable in the Quilt module directly ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have a configuration object with a configuration pattern though. The new API is Quilt.logger which delegates to Quilt.configuration.logger. As long as the API is the same I don't see any problems.

Copy link
Contributor

@Edouard-chin Edouard-chin Aug 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem indeed but since you are delegating Quilt.logger to the configuration I don't see the point of not adding that directly in the Quilt module. That being said you also can't use delegate because that gem don't depend on active support

Copy link
Member Author

@gmcgibbon gmcgibbon Aug 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem indeed but since you are delegating Quilt.logger to the configuration I don't see the point of not adding that directly in the Quilt module.

I mainly want to maintain the contract of the configuration object. We would have to deprecate Quilt.configuration too if we want configuration accessors to live on the root module.

That being said you also can't use delegate because that gem don't depend on active support

It depends on railties which depends on active support, but I could add a dependency in the gemspec to make that more apparent.

@gmcgibbon gmcgibbon merged commit a9f781e into master Aug 27, 2020
@gmcgibbon gmcgibbon deleted the config_logger branch August 27, 2020 01:25
@ismail-syed ismail-syed deployed to pr-fix-beta-test August 31, 2020 15:04 Active
@ismail-syed ismail-syed temporarily deployed to production September 2, 2020 18:16 Inactive
@marutypes marutypes temporarily deployed to gem February 8, 2021 15:51 Inactive
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants