Skip to content
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

question(log): public methods in classes #4392

Open
5 tasks
timreichen opened this issue Feb 25, 2024 · 1 comment
Open
5 tasks

question(log): public methods in classes #4392

timreichen opened this issue Feb 25, 2024 · 1 comment
Labels
feedback welcome We want community's feedback on this issue or PR

Comments

@timreichen
Copy link
Contributor

Is your feature request related to a problem? Please describe.

There seem to be a lot of public methods in classes that might ought to be private or protected:

  • BaseHandler
    • log()
  • ConsoleHandler
    • applyColors()
  • FileHandler
    • flush()
  • RotatingFileHandler
    • rotateLogFiles()
  • Logger
    • asString()

Is this by design or unintentional?

Describe the solution you'd like

Make them private or protected.

Describe alternatives you've considered

Leave as is.

@timreichen timreichen changed the title Question(log): public methods in classes question(log): public methods in classes Feb 25, 2024
@iuioiua
Copy link
Collaborator

iuioiua commented Mar 3, 2024

I agree with all of these points. My understanding and reasoning are:

  1. BaseHandler.log() doesn't even need to exist for the same reasons that the other logging methods (i.e. warn(), etc.) don't exist. That should be left up to the classes that extend BaseHandler for consistency.
  2. ConsoleHandler.applyColors() seems to be only being used internally in .format().
  3. The user should use FileHandler.destroy() instead of FileHandler.flush().
  4. I don't see why a user must manually call RotatingFileHandler.rotateLogFiles() as this is automatically taken care of while using .log().
  5. There doesn't seem to be a use case for Logger.asString() as part of the public API.

@iuioiua iuioiua added the feedback welcome We want community's feedback on this issue or PR label Mar 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feedback welcome We want community's feedback on this issue or PR
Projects
None yet
Development

No branches or pull requests

2 participants