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

Allow access to writer and provider #158

Closed
Git5000 opened this issue Aug 13, 2020 · 3 comments
Closed

Allow access to writer and provider #158

Git5000 opened this issue Aug 13, 2020 · 3 comments
Assignees
Milestone

Comments

@Git5000
Copy link
Contributor

Git5000 commented Aug 13, 2020

The automatic loading via services of (custom) writers and providers is nice but prevents access to the created objects (unless you call out somewhere from the constructor). Is it possible to add getters for writers and maybe providers. The idea behind it is to change writer properties at runtime.

Possible solution:
Add getProviders() to BundleLoggingProvider to get its internal array.
Add getWriters() or getWriter(tag,level) or getWriters(tag) to TinylogLoggingProvider.

@Git5000
Copy link
Contributor Author

Git5000 commented Aug 16, 2020

Attached is a possible patch for above issue. The patch is against V2.1.2 (api and impl) but I would guess it is the same against HEAD. Feedback or suggestions are of course welcome.

It affects:

  • TinylogLoggingProvider.java
  • BundleLoggingProvider.java
  • ProviderRegistry.java

and gives you:

  • ProviderRegistry.getLoggingProviders() // Resolves the Bundle if it is a bundle otherwise the provider
  • TinylogLoggingProvider.getWriters() // Get all writers of the provider
  • TinylogLoggingProvider.getWriters(final String tag) // Get all writers of the provider registered for a tag (or no tag)
  • TinylogLoggingProvider..setWriters(final String tag, final Level level) // The same but with a level (all at and above the level)

Actually I think that the setWriters(final String tag, final Level level) is not necessary and should be left out. But for completeness the patch contains it.

impl_patch.txt
api_patch.txt

@pmwmedia
Copy link
Member

pmwmedia commented Aug 17, 2020

@Git5000 Could you provide your changes as pull requests and add some JUnit tests? I would be glad to merge your changes!

@github-actions
Copy link

github-actions bot commented Oct 9, 2022

This closed issue has been locked automatically. However, please feel free to file a new issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

2 participants