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

[feature] non-static (object based) access of context data is sometimes misleading #92

Open
XSven opened this issue Nov 11, 2022 · 1 comment

Comments

@XSven
Copy link
Contributor

XSven commented Nov 11, 2022

I have started this week to play with the Log::Any context data and structured data feature. With respect to the context data feature I was misled by the object method based access: $log->context. I thought the context belongs to the logger and maybe to subloggers, if we take logger category namespace inheritance into consideration. But if I have understood it right now the context is a property of the Log::Any::Manager singleton instance. From my perspective the following class method should be added to Log::Any

sub get_context { $manager->get_context }

If this sounds reasonable I can create a PR.

@XSven XSven changed the title [feature] non-static (object based) access of context data is misleading [feature] non-static (object based) access of context data is sometimes misleading Nov 11, 2022
@preaction
Copy link
Owner

Unfortunately, the context is global because the proxy objects don't have any kind of parent/child relationship, and trying to infer one based on categories would be impossible. Having a plain Log::Any->context accessor would probably be fine: It aligns with my desire to get rid of the Manager class entirely and move all its functionality into the base Log::Any class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants