Skip to content
This repository has been archived by the owner on Nov 24, 2022. It is now read-only.

Logging 'withContext' and 'withAllLimits' #18

Open
Clint-Chester opened this issue Apr 12, 2019 · 2 comments
Open

Logging 'withContext' and 'withAllLimits' #18

Clint-Chester opened this issue Apr 12, 2019 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@Clint-Chester
Copy link

Is your feature request related to a problem? Please describe.
Not related to a problem, just love the way that this has been architected and would love to contribute and add new features 😄

Describe the solution you'd like
Using the pattern already implemented for the methods such as 'withRequest', 'withResponse', 'withException' and 'withQuery', implementing the following two new methods:

  • withAllLimits: making use of the Limits class to report on resources used vs. resources available. Was thinking it could publish all limits initially as a starting point.
  • withContext: making use of the System class and UserInfo class to identify context of the transaction such as the UI Theme Displayed, is a Batch running, is it in a Future context etc.

Describe alternatives you've considered
It seemed a shame to house this type of functionality in an extended publishing function of the logging outside of this class. Not sure if the naming paradigm should be 'includeContext' and 'includeAllLimits' so it could read something like:

log.withException(ex).includeContext().error('failed to query contact');

Additional context
Happy to do a draft branch but just wanted to gauge thoughts on the idea first.

@davidsbond
Copy link
Owner

Hey @Clint-Chester, thanks for contributing! I like this idea and thanks for your positive opinion on the library. I'm a little busy at the moment but please feel free to fork this repo and implement those changes. I may need to update our CI pipeline to build forked repos, but that should just be a check box somewhere.

I think logging is something Salesforce doesn't do well out of the box, so am happy to take most additions that increase the quality of people's logs.

@davidsbond davidsbond added enhancement New feature or request good first issue Good for newcomers labels Apr 14, 2019
@Clint-Chester
Copy link
Author

Sweet! Will take a crack at it next week 😄

@davidsbond davidsbond added the help wanted Extra attention is needed label Mar 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants