def emit(self, record): request = get_current_request() record.ip = get_ip(request) record.user = get_user(request) super(CustomStreamHandler, self).emit(record)
the request is always None ? 在 2017年5月31日星期三 UTC+8下午10:15:53,tonthon写道: > > You can use Custom Formatters, an example here : > https://github.com/CroissanceCommune/autonomie/blob/master/autonomie/log.py > > Ini file part : > > > https://github.com/CroissanceCommune/autonomie/blob/master/development.ini.sample#L153 > > https://github.com/CroissanceCommune/autonomie/blob/master/development.ini.sample#L181 > > Hope this can help > > Gaston > http://majerti.fr > > > Le 27/05/2017 à 05:04, Guohuang Chen a écrit : > > can i add something to the pyramid logging ? such as session['login_name'] > remote-ip ... > -- > You received this message because you are subscribed to the Google Groups > "pylons-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] <javascript:>. > To post to this group, send email to [email protected] > <javascript:>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/pylons-discuss/4a758c61-1f22-460a-bde9-a4e047d8e389%40googlegroups.com > > <https://groups.google.com/d/msgid/pylons-discuss/4a758c61-1f22-460a-bde9-a4e047d8e389%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > > > -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/88c946f9-2dfa-48ac-859e-59442dcb9bfe%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
