deno_std icon indicating copy to clipboard operation
deno_std copied to clipboard

BREAKING(log): change `setup` and `destroy`

Open timreichen opened this issue 1 year ago • 5 comments

Ref: https://github.com/denoland/std/issues/4391

Changes This PR remove the setup() and destroy() methods from BaseHandler. It removes the setup() and destroy() method calls in the setup() function. ~It makes BaseHandler and log() abstract.~ It adds a check whether the file is open when log() is called. If not, it opens it.

timreichen avatar Aug 16 '24 23:08 timreichen

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.23%. Comparing base (c8fe634) to head (5253751). Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5701      +/-   ##
==========================================
- Coverage   96.23%   96.23%   -0.01%     
==========================================
  Files         480      480              
  Lines       38743    38736       -7     
  Branches     5616     5616              
==========================================
- Hits        37286    37279       -7     
  Misses       1416     1416              
  Partials       41       41              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Aug 18 '24 14:08 codecov[bot]

I'm not in favor of this change. This doesn't solve anything, but changes things in breaking way, based on aesthetic reason/naming preference.

kt3k avatar Aug 19 '24 06:08 kt3k

I'm not in favor of this change. This doesn't solve anything, but changes things in breaking way, based on aesthetic reason/naming preference.

Well, it removes the necessity of having the setup and destroy functions at all and thus simplifies the api. Renaming them in the FileHandler to open() and close() describes what they do better imo.

Are you not in favour of both or just one of these changes?

timreichen avatar Aug 19 '24 10:08 timreichen

I'm not in favor of either.

it removes the necessity of having the setup and destroy functions at all and thus simplifies the api.

I don't understand this. It gives the default (empty) implementation. The inherited classes don't need to implement them.

kt3k avatar Aug 19 '24 11:08 kt3k

I'm not in favor of either.

it removes the necessity of having the setup and destroy functions at all and thus simplifies the api.

I don't understand this. It gives the default (empty) implementation. The inherited classes don't need to implement them.

What I mean is that users can use the constructor() as a setup() function and dispose() as a destroy() function. There is no need for api specific functions.

timreichen avatar Aug 19 '24 11:08 timreichen

I understand both the reasons for and against this change. However, I'll close this without merge as I think the method names are fine as-is.

iuioiua avatar Aug 25 '24 03:08 iuioiua