italomaia / flask-empty

An empty project skeleton / boilerplate for flask projects. Powered by CookieCutter.
667 stars 93 forks source link

Configure logging in empty project #4

Closed ayvazj closed 8 years ago

italomaia commented 11 years ago

Ayvazj, how would you feel about turning your suggestion into a configurable extension?

ayvazj commented 11 years ago

what do you mean exactly? Do you have an example?

On Fri, Aug 2, 2013 at 11:02 PM, Italo Maia notifications@github.comwrote:

Ayvazj, how would you feel about turning your suggestion into a configurable extension?

— Reply to this email directly or view it on GitHubhttps://github.com/italomaia/flask-empty/pull/4#issuecomment-22048043 .

italomaia commented 11 years ago

I've given some thinking to your pull request. It is very clean and adds useful functionality to flask-empty, but I believe it would work in a more broad and powerful way as a flask-extension (http://flask.pocoo.org/extensions/) Flask extensions are modules that extend the funcionality of applications in an easy way and proper logging setup seems like a good scenario for it.

Look at the hipotetical example below:

def configure_logging(app, config):
    logger = Logging(app)  # where Logging or other name is the logging 
    logger.setup(logger.FILE)  # for file based logging
    logger.setup(logger.EMAIL, level=logger.ERROR)  # for email based logging
    # other setup ...

In this case, all configuration for logger could remain in config, while in configure_logging you could specify how you want logging to be handled. In django, you can change how logging behaves with just a few lines of code. Email, file, whatever. If that behavior was available to flask as an extension, it would be very nice. How do you feel about this suggestion?

ayvazj commented 11 years ago

sounds like a good idea, and I would love to contribute to flask community -- very happy flask user.

On Sun, Aug 4, 2013 at 3:31 PM, Italo Maia notifications@github.com wrote:

I've given some thinking to your pull request. It is very clean and adds useful functionality to flask-empty, but I believe it would work in a more broad and powerful way as a flask-extension ( http://flask.pocoo.org/extensions/) Flask extensions are modules that extend the funcionality of applications in an easy way and proper logging setup seems like a good scenario for it.

Look at the hipotetical example below:

def configure_logging(app, config): logger = Logging(app) # where Logging or other name is the logging logger.setup(logger.FILE) # for file based logging logger.setup(logger.EMAIL, level=logger.ERROR) # for email based logging

other setup ...

In this case, all configuration for logger could remain in config, while in configure_logging you could specify how you want logging to be handled. In django, you can change how logging behaves with just a few lines of code. Email, file, whatever. If that behavior was available to flask as an extension, it would be very nice. How do you fell about this suggestion?

— Reply to this email directly or view it on GitHubhttps://github.com/italomaia/flask-empty/pull/4#issuecomment-22078301 .

italomaia commented 8 years ago

Close. Will wait for logging plugin.