librelist archives

« back to archive

New extension Flask-Logging

New extension Flask-Logging

From:
James Ayvaz
Date:
2013-08-05 @ 11:55
Hello everyone,

> Remember: good API design is hard, so introduce your project
> on the mailinglist, and let other developers give you a helping
> hand with designing the API.

Is there any interest in a Flask-Logging extension that simplifies logging
in Flask applications?

What are the killer features that you would like to see in a logging
extension?

Any other feedback or suggestions?

Thanks for help.

Re: [flask] New extension Flask-Logging

From:
Jaime Wyant
Date:
2013-08-05 @ 13:08
It would be great to have it email me application errors.  Flask will
already do this, but it has to be configured with some boilerplate code.

It would really be nice to be able to do something like this ->

config['LOG_ADMINISTRATORS'] = ['me@here.com']
config['LOG_EMAIL_ERRORS'] = True

# Optional stuff
config['LOG_EMAIL_ERROR_SUBJECT'] = 'Cool App - Bad Error'
config['LOG_EMAIL_THROTTLE'] = 1

^^ The email throttle would be nice.  I'm not sure what this value
represents yet -- maybe emails a minute or something...  And this may even
be something to do with a customized handler.  The idea is, your app is
crashing repeatedly, for the same reason -- you don't want to flood your
email box.  Heck, while we're just dreaming here - it'd be nice to be able
to get a special email when the throttling threshold has been met.  For
instance, if my app has produced 30 errors in rapid succession, I'd like to
know this somehow.   But really, that's just a perk.  Easy email
notification of the errors should suffice.

jw


On Mon, Aug 5, 2013 at 6:55 AM, James Ayvaz <james.ayvaz@gmail.com> wrote:

> Hello everyone,
>
> > Remember: good API design is hard, so introduce your project
> > on the mailinglist, and let other developers give you a helping
> > hand with designing the API.
>
> Is there any interest in a Flask-Logging extension that simplifies logging
> in Flask applications?
>
> What are the killer features that you would like to see in a logging
> extension?
>
> Any other feedback or suggestions?
>
> Thanks for help.
>
>


-- 
"Government does not solve problems; it subsidizes them."
Ronald Reagan

Re: [flask] New extension Flask-Logging

From:
Owein Reese
Date:
2013-08-05 @ 13:12
+1 to the just add a self.logging to a request or MethodView. Small,
simple, reduces some boilerplate for me too (I have my own version based on
module name.)
Hello everyone,

> Remember: good API design is hard, so introduce your project
> on the mailinglist, and let other developers give you a helping
> hand with designing the API.

Is there any interest in a Flask-Logging extension that simplifies logging
in Flask applications?

What are the killer features that you would like to see in a logging
extension?

Any other feedback or suggestions?

Thanks for help.

Re: [flask] New extension Flask-Logging

From:
Dave Shawley
Date:
2013-08-07 @ 11:49
On Aug 5, 2013, at 9:12 AM, Owein Reese <owreese@gmail.com> wrote:

> +1 to the just add a self.logging to a request or MethodView. Small, 
simple, reduces some boilerplate for me too (I have my own version based 
on module name.)


I could definitely see the utility of request or view specific loggers.  
It would be nice if the logger was built as a mixin so that it can be 
mixed in alongside AcceptMixin in the request chain or ResponseStreamMixin
in the response chain.  The logger should either (1) include identifying 
attributes of the request/response/session/whatever or (2) automatically 
insert identifiers into the list of keywords accessible to the format 
statement.  A mixin approach would make it possible to plug it in by 
adding a wrapper class and setting the request_class and response_class 
attributes of the Flask application class.  Then the request and response 
objects would expose log methods that have access to the request and 
response specific attributes.

I would probably build this over top of logbook after taking a closer look
at it (thanks to the note from David Baumgold).  It uses the newer string 
formatting and supports inject arbitrary keywords into log statements 
which you can definitely take advantage of here.

This should be a nice little project and inherently useful to anyone that 
deploys a non-trivial Flask application.
--
"While the Internet does have a tradition of accepting reality when 
creating specifications, this should not be done at the expense of 
interoperability." - RFC3339.

Re: [flask] New extension Flask-Logging

From:
Italo Maia
Date:
2013-08-13 @ 03:26
Wow, folks seem excited with this extension possibility. Add me to the
gang! A logging extension with django-like capabilities (aka email errors
and so on) would be great!


2013/8/7 Dave Shawley <daveshawley@gmail.com>

> On Aug 5, 2013, at 9:12 AM, Owein Reese <owreese@gmail.com> wrote:
>
> +1 to the just add a self.logging to a request or MethodView. Small,
> simple, reduces some boilerplate for me too (I have my own version based on
> module name.)
>
>
> I could definitely see the utility of request or view specific loggers.
>  It would be nice if the logger was built as a mixin so that it can be
> mixed in alongside AcceptMixin in the request chain or ResponseStreamMixin
> in the response chain.  The logger should either (1) include identifying
> attributes of the request/response/session/whatever or (2) automatically
> insert identifiers into the list of keywords accessible to the format
> statement.  A mixin approach would make it possible to plug it in by adding
> a wrapper class and setting the request_class and response_class attributes
> of the Flask application class.  Then the request and response objects
> would expose log methods that have access to the request and response
> specific attributes.
>
> I would probably build this over top of logbook after taking a closer look
> at it (thanks to the note from David Baumgold).  It uses the newer string
> formatting and supports inject arbitrary keywords into log statements which
> you can definitely take advantage of here.
>
> This should be a nice little project and inherently useful to anyone that
> deploys a non-trivial Flask application.
> --
> "While the Internet does have a tradition of accepting reality when
> creating specifications, this should not be done at the expense of
> interoperability." - RFC3339.
>
>


-- 
"A arrogância é a arma dos fracos."

===========================
Italo Moreira Campelo Maia
Mestre em Ciências da Computação - UECE
Analista de Sistemas / Desenvolvedor Web, Desktop e Mobile
Trainee B2W
-----------------------------------------------------
http://www.italomaia.com/
http://twitter.com/italomaia/
http://eusouolobomau.blogspot.com/
-----------------------------------------------------
Turtle Linux  9.10 - http://tiny.cc/blogturtle910
Turtle Linux 10.10 - http://bit.ly/cEw4ET
===========================

Re: [flask] New extension Flask-Logging

From:
David Baumgold
Date:
2013-08-05 @ 13:19
I've never used it myself, but Logbook looks like a nice alternative to 
the built-in logging module: https://github.com/mitsuhiko/logbook (And 
it's made by the same guy who wrote Flask!) It would be cool if you could 
investigate writing a Flask extension that can integrate with either the 
built-in logging module or with Logbook -- but only if the APIs are 
reasonably compatible. If not, they would be better off as two separate 
Flask extensions for the two separate logging modules.
-David



On Monday, August 5, 2013 at 9:12 AM, Owein Reese wrote:

> +1 to the just add a self.logging to a request or MethodView. Small, 
simple, reduces some boilerplate for me too (I have my own version based 
on module name.)
> Hello everyone,
> 
> > Remember: good API design is hard, so introduce your project 
> > on the mailinglist, and let other developers give you a helping
> > hand with designing the API.
> 
> 
> Is there any interest in a Flask-Logging extension that simplifies 
logging in Flask applications?
> 
> What are the killer features that you would like to see in a logging extension? 
> 
> Any other feedback or suggestions?
> 
> Thanks for help. 

Re: [flask] New extension Flask-Logging

From:
Kristofer M White
Date:
2013-08-05 @ 12:50
I think the biggest benefit to a flask-logging extension would be 
something that reduces the work required to do logging. Perhaps any module
that will log can just have a call like:

self.logger = flask.ext.logger(self_or_string_with_logger_name)
self.logger.format(str_for_log_format)

When adding modules to my apps, that is about the extent of the work I 
want to do when logging. No more required, but additional customization 
optional. If it makes my job easier, I would definitely use it. :)

James Ayvaz <james.ayvaz@gmail.com> wrote:
>Hello everyone,
>
>> Remember: good API design is hard, so introduce your project
>> on the mailinglist, and let other developers give you a helping
>> hand with designing the API.
>
>Is there any interest in a Flask-Logging extension that simplifies
>logging
>in Flask applications?
>
>What are the killer features that you would like to see in a logging
>extension?
>
>Any other feedback or suggestions?
>
>Thanks for help.

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

Re: [flask] New extension Flask-Logging

From:
Mauricio de Abreu Antunes
Date:
2013-08-05 @ 12:56
a flask-logging would be very helpful if it could be have a
configuration and a simple usage like kristofer said above.
a decorator that can be applied to a function, maybe, instead of
calling logging module everytime. but i am not sure how it would be
helpful, it kind of breaks some design API rules, no?

2013/8/5 Kristofer M White <me@kmwhite.net>:
> I think the biggest benefit to a flask-logging extension would be something
> that reduces the work required to do logging. Perhaps any module that will
> log can just have a call like:
>
> self.logger = flask.ext.logger(self_or_string_with_logger_name)
> self.logger.format(str_for_log_format)
>
> When adding modules to my apps, that is about the extent of the work I want
> to do when logging. No more required, but additional customization optional.
> If it makes my job easier, I would definitely use it. :)
>
>
> James Ayvaz <james.ayvaz@gmail.com> wrote:
>>
>> Hello everyone,
>>
>> > Remember: good API design is hard, so introduce your project
>> > on the mailinglist, and let other developers give you a helping
>> > hand with designing the API.
>>
>> Is there any interest in a Flask-Logging extension that simplifies logging
>> in Flask applications?
>>
>> What are the killer features that you would like to see in a logging
>> extension?
>>
>> Any other feedback or suggestions?
>>
>> Thanks for help.
>>
>
> --
> Sent from my Android device with K-9 Mail. Please excuse my brevity.



-- 
Mauricio de Abreu Antunes
Mobile: (51)930-74-525
Skype: mauricio.abreua