Logger and Configuration Class Examples

Discussion in 'Resources' started by Don Redhorse, Nov 8, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    Don Redhorse


    as I like comments in my Configuration Files I looked around for a way to make that happen.
    One way is to include the config.yml in your plugin and extract it on the fly.. but there is a problem if you want to update in this case. That and the need for a nice and easy logging mechanism.. incl debugging lead me to write 2 classes to help me with my plugins.

    As I think they could be helpful for others which have similar issues I would like to share them.

    I also hope to get back some feedback and perhaps even enhancements to make those classes do even more in a simpler way. Thanks to @xZise for the basis of the LoggerClass and thanks to ???? for the idea on how to write the config.yml in an other way.

    So what are the features of those classes?


    • AutoDeploy of config.yml
    • AutoUpdate of config.yml without overwriting old values
    • VersionCheck of Plugin
    • Comments... Comments... Comments

    • Methods for the different LogLevels INFO, WARNING, SEVERE
    • INFO LogLevel only shows up in Logs if errorLogEnabled is true
    • log Methods to directly log messages
    • "LogLevel" DEBUG and ERROR which log with INFO level if the function is enabled
    • enableMsg() and disableMsg() which will always be logged
    • also an easy way to log exceptions
    Wiki, Javadocs, Source, Examples, Link to example project (working Plugin really)

    I welcome any feedback and enhancements... also of course any "bug" reporting..
    r3Fuze likes this.
  2. Offline

    Don Redhorse

    just for a heads up... this only works when you are using the default config.yml file... otherwise you will need to change some stuff.

    Also if you have a lot of different configs the approach of having a singleton classs isn't very intelligent if you want to create a base class...

    so I will think about a new approach... I will let you know when I found one..

    oh, and I still think that this is still a quite ok approach to create a heavy commented config file which you are being able to automatically update without loosing your old config.
Thread Status:
Not open for further replies.

Share This Page