New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Instantiate logging depending on environment #1343
Conversation
eb645bb
to
2efb4a2
Compare
@timEulitz @tzhelyazkova I'm unsure about some parts of the refactoring:
|
use WMDE\Fundraising\Frontend\Factories\FunFunFactory; | ||
use WMDE\Fundraising\Frontend\Tests\Fixtures\FakeUrlGenerator; | ||
|
||
class TestEnvironmentSetup implements EnvironmentSetup { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double space omg what does it mean?
It's clear to me but I don't think it would hurt to leave a short sentence about that (also with regards to the fact that we will be getting an intern soonish and that there will be other people in the future who might not know).
I think overall the EnvironmentFactory you propose would make the code better to read because you can more easily point at a named place in the code in which environment configurations are applied rather than a couple of random lines in the index files. You can also probably get rid of hard-coding the The thing that bugs me the most about it is that a Factory builds another Factory which seems very weird and kinda convoluted to me, but overall I think in this instance it's actually okay. |
c18c189
to
3948185
Compare
bb13d9a
to
d5f80ba
Compare
Change all app entry points to use APP_ENV environment variable to determine environment name. Use 'dev' as default. Use "prod" when deploying. Adapt Makefile Explain environments in README. Inspired by https://symfony.com/doc/current/configuration/environments.html
Setup up entities that are environment-dependent in environment-specific factories. Change dev environment logging to standard error output and change format to text instead of JSON.
Add `logging` configuration key. Add factory for setting up logging depending on configuration key - use error log, file or graylog. Pass configuration to environment factories. Added GELF library as a dependency for logging to Graylog. Simplified production logging - removed the "FingersCrossed" handler and the two different log outputs.
Also document how the campaign configurations are set up.
Make EnvironmentBootstrapper an instantiable class with overrideable defaults, override them in the test environment.
Check that only the expected things are modified, but not how they're modified. Also simplify logger construction because each logger has only one, predefined handler.
2114ea6
to
c8fddfc
Compare
Feature: https://phabricator.wikimedia.org/T200676