Open heyjaywilson opened 2 weeks ago
I would like to this issue.
@rajhraval it's all yours!
Just have some doubts:
Each package should have it's own log category
So it should be called like PFLogger.error(package: .design, error) Denoting it is an error from Design Package?
The logger should live in the utilities package
But if all packages import the Utilities package isn't it bad? That you are importing a single package too many times in different packages?
PFLogger.error(package: .design, error)
I've tried doing stuff like this before, but I end up loosing functionality from the Logger
in OSLog. I more so imagined it working like this:
// Error example
PFLogger.log(.design).error("message here")
// Debug example
PFLogger.log(.dataStorage).info("Saved a new exercise: \(exercise.name, privacy: .public)")
the .log function takes in a category that is whatever package it's being called from or even more specific category added later (like maybe one for a service) and returns a properly configured Logger
with . The .error()
is the Logger's built in error. This allows us to utilize the message capability to mark values as private if needed.
I should have probably put more of this in the issue description, so I'm sorry about that.
But if all packages import the Utilities package isn't it bad?
There shouldn't be an issue. This project uses a modularized code base and that's exactly what this does. If you have any docs or articles saying otherwise, then I'd love to read them.
Hopefully that helps answer some questions
Oh, like this. @heyjaywilson I have raised a PR with my kind of implementation not replaced with print statements yet. I will improve based on your opinion.
@rajhraval i'm gonna look at the PR after work today. Sorry for the delay.
Change all print statements to use
Logger
from OSLog.dev.cctplus.peakfit
chore
Resources: