pmmp / PocketMine-MP

A server software for Minecraft: Bedrock Edition in PHP
https://pmmp.io
GNU Lesser General Public License v3.0
3.28k stars 1.56k forks source link

Introduce per-component logging configurations #3120

Open dktapps opened 5 years ago

dktapps commented 5 years ago

With the work that has been done in recent months to de-globalise logging, more and more subsystems of PocketMine-MP now have their own dedicated logger for prefixing and for scope isolation.

This de-globalisation also offers an opportunity to make logging configuration much more flexible.

Proposal

That each logger should have a "log level", ordered in severity as per PSR-3. A logger will have a minimum log level, below which messages will be ignored (e.g. a minimum configuration of WARNING will cause INFO and DEBUG messages to be silenced).

Different subsystems will have their own loggers, which can each have their own minimum log level. This permits things such as having active plugin DEBUG loggers, while avoiding network DEBUG spam.

Example proposed pocketmine.yml configuration

logging:
    default: debug #default logging level, subsystems configuration may override
    network: info #silence network-specific debug, to avoid packet spam noise
    plugins:
        MyDevelopmentPlugin: debug
        SomeNoisyPlugin: warning

Notes

This proposal is not final and I acknowledge that it's not perfect. Please give any feedback you might have.

SOF3 commented 5 years ago

What are the complexities of completely switching to an actual PSR-3 implementation that supports logger configuration?

dktapps commented 5 years ago

I don't see what PSR-3 has to do with it.