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

Wrong documentation abt Logging in Piwik 3.x #12307

Open
tassoman opened this issue Nov 29, 2017 · 7 comments
Open

Wrong documentation abt Logging in Piwik 3.x #12307

tassoman opened this issue Nov 29, 2017 · 7 comments

Comments

@tassoman
Copy link
Contributor

Ciao!
I'm updating an old plugin born while Piwik was 1.x. It flawless worked inside Piwik 2.x but now must be updated.

I've started from scratch generating plugin's parts using console generator. Now I have a custom Dimension, I'm on its development and I'm trying to log things inside plugins/ThePlugin/Columns/ColumnName.php onNewVisit method.

Piwik 3.x Logging documentation suggests to log using StaticContainer::getContainer()->get('Psr\Log\LoggerInterface') (as 2.X docs said before) but inside PHPStorm that stuff pops up as deprecated.
While I was reading StaticContainer source code I found a note: in 3.X release will be removed.

  • looks like isn't removed yet
  • there's no indication how to use DI instead
  • 3.X documentation seems inconsistent

Any help and suggestion how to get rid of StaticContainer and using real DI is appreciated 😸
Best regards, thank you

@simivar
Copy link
Contributor

simivar commented Feb 15, 2018

@sgiehl @mattab @tsteur any suggestions?

@mattab
Copy link
Member

mattab commented Feb 16, 2018

not sure myself what to answer - @sgiehl @tsteur maybe we could remove the note that it is deprecated or so, or what would you suggest as next step?

@tsteur
Copy link
Member

tsteur commented Feb 16, 2018

It won't be removed any time soon and feel free to use it. Won't even b removed in Matomo 4.0.

In case you want to log eg in a dimension, this should work best without needing to use StaticContainer:

    public function __construct(\Psr\Log\LoggerInterface $log)
    {
        $this->log = $log;
    }

There is no doc to be updated as StaticContainer is still deprecated and avoided to be used. Although the message "that it will be removed in 3.0" could be actually removed :)

@simivar
Copy link
Contributor

simivar commented Feb 16, 2018

Okay, thanks. As far as I understand is that StaticContainer will be deleted in future (a distant one) and replaced with Dependency Injection but that's not happening now because of more presssing issues and lack of hands, is that correct?

@tsteur
Copy link
Member

tsteur commented Feb 16, 2018

yep

@tassoman
Copy link
Contributor Author

For me is enough to know and I think if someone will find help about it will find this post.
The only thing stills open is this:

I found a note: in 3.X release will be removed.

Maybe should be updated «in 4.x release will be removed» ?

Thank you all for supporting ^ç^

@simivar
Copy link
Contributor

simivar commented Feb 16, 2018

I would propose removing "that it will be removed in 3.0" and instead link to this issue as it makes everything clear.

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

5 participants