mlem icon indicating copy to clipboard operation
mlem copied to clipboard

Unified Logging

Open schmeat opened this issue 1 year ago • 3 comments

Checklist

  • [x] I have read CONTRIBUTING.md
  • [x] I have described what this PR contains
  • [x] This PR addresses one or more open issues that were assigned to me: - #124
  • [x] If this PR alters the UI, I have attached pictures/videos

Pull Request Information

About this Pull Request

This is just a proof of concept for logging right now, with minimal files edited. Want to get consensus before I modify every file with logging. @Sjmarf @EricBAndrews

Additional Context

N/A for now

schmeat avatar Feb 01 '24 07:02 schmeat

It would be nice to have a linting rule to warn people using print to use MlemLogger instead. ~~I'm not sure how to do that in current project since I don't see a swiftlint markup file.~~

I see the file in root, of course. I'll update the rule at the end.

schmeat avatar Feb 01 '24 07:02 schmeat

I like the concept! I'm tentatively scoping this for 1.3--pending the face ID PR, we're in full bugfix mode for the 1.2 release.

Re: categorization, I think that would be a good idea--there's a lot of discussion to be had about what those categories should be, but the added dev time categorizing logs has in my experience always paid off eventually.

We might want to look into an architecture like this one, where categorized loggers are defined as static properties on the Logger class--that saves us from needing to dependency inject or instantiate loggers everywhere

EricBAndrews avatar Feb 01 '24 13:02 EricBAndrews

Yeah makes sense with categorization. I didn't make it statically defined because I have the file name coming in through the init. Once we define the categories, I won't need to do that.

schmeat avatar Feb 01 '24 20:02 schmeat