Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ehuelsmann
Copy link
Member

Description

Per Log::Log4perl's recommendation (see https://metacpan.org/pod/Log::Log4perl#Pitfalls-with-Categories),
use the class of the instance as the category for purposes of logging -- where possible.

This allows much better control over which parts of the application do
logging and which parts don't.

Type of change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

The reason I'm considering this a breaking change is because logging configuration might need to be adjusted for inherited classes (not for Workflow classes themselves): Since I don't expect there to be a specific logging configuration for the Workflow category, all the loggers will fall back to the current default, which they already did by calling get_logger(). For any inherited loggers in different toplevel namespaces (e.g. LedgerSMB::Workflow::Action::Email), a different logging category may be selected (i.e. LedgerSMB), resulting in different logging results than before.

Where to document this?

Checklist:

  • My code follows the style guidelines of this project, please see the contribution guidelines.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@ehuelsmann ehuelsmann added the enhancement Feature/improvement label Jan 25, 2021
@ehuelsmann
Copy link
Member Author

Travis says I made a mistake here. I'll fix that before you should look at it.

@ehuelsmann ehuelsmann force-pushed the more-specific-logger branch from 61b24f5 to 3467ad2 Compare January 25, 2021 23:05
@coveralls
Copy link

coveralls commented Jan 26, 2021

Coverage Status

Coverage decreased (-0.06%) to 82.46% when pulling 2f4a177 on ehuelsmann:more-specific-logger into 2d9ce44 on jonasbn:master.

@ehuelsmann ehuelsmann requested review from jonasbn and oliwel January 29, 2021 08:36
Per Log::Log4perl's recommendation (see https://metacpan.org/pod/Log::Log4perl#Pitfalls-with-Categories),
use the class of the instance as the category for purposes of logging -- where possible.

This allows much better control over which parts of the application do
logging and which parts don't.
@ehuelsmann ehuelsmann force-pushed the more-specific-logger branch from 3467ad2 to 3e79314 Compare January 29, 2021 09:58
@ehuelsmann
Copy link
Member Author

Travis says I made a mistake here. I'll fix that before you should look at it.

Fixed.

@ehuelsmann
Copy link
Member Author

@jonasbn this branch is ready to be merged. The reason it says checks are failing is because coverage dropped by 0.1%, which is a consequence of me having removed more tested than untested code lines.
However, I don't see how I can improve coverage while sticking to the intent of the PR.

Please review.

@jonasbn jonasbn changed the title Use the instance class as the logging caterogy Use the instance class as the logging category Mar 3, 2021
@jonasbn
Copy link
Collaborator

jonasbn commented Mar 3, 2021

Hi @ehuelsmann

Even though it looks massive, the theme of the PR is somewhat uniform. I do not expect this PR review to be as extensive. I will see if I can find the time shortly.

@ehuelsmann
Copy link
Member Author

@jonasbn no hurry; this one is indeed much simpler than the other one. If I can choose, I also prefer this one, because it touches more code and would be nice to have that out of the way for any further PRs. The other one is much more localized.

Copy link
Collaborator

@jonasbn jonasbn left a comment

Choose a reason for hiding this comment

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

Hi @ehuelsmann

I have made some minor remarks. Could you please go over them. One is cosmetic and two are actually the same pattern, where I might just be missing something.

ehuelsmann and others added 2 commits March 8, 2021 20:02
The Id generating classes referred to the `log` method, which neither
defined. This commit defines a `log` accessor for the attribute by
the same name.

Incidentally align the implementations of `SequenceId` and
`AutoGeneratedId` in that they both document their properties,
both define a `new` method and both define a `log` attribute now.
@jonasbn
Copy link
Collaborator

jonasbn commented Mar 9, 2021

Hi @ehuelsmann

I think we should consider releasing this as a major release based on your initial comment and flagging as the PR as breaking

@ehuelsmann
Copy link
Member Author

Hi @ehuelsmann

I think we should consider releasing this as a major release based on your initial comment and flagging as the PR as breaking

Yes, I think that you're right. It's a more strict interpretation of SEMVER than I would have used on my own software, because I consider logging more of a secondary or supporting functionality -- I wouldn't have thought to apply SEMVER to that too (as the primary functionality and documented API didn't change).

Anyway, a question that comes up when you say that is: should we then plan for more rigorous change? Maybe changes including the API?

@jonasbn jonasbn merged commit 4db6ec9 into perl-workflow:master Mar 10, 2021
@ehuelsmann ehuelsmann deleted the more-specific-logger branch April 25, 2021 20:29
@jonasbn jonasbn added this to the 1.53 milestone Jul 31, 2021
ehuelsmann added a commit that referenced this pull request Jul 31, 2021
Minor addition to change log, an important PR (#69) was not listed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Feature/improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants