[IPython-dev] iplogging suggestions added

Omar Andrés Zapata Mesa andresete.chaos@gmail....
Sat Dec 11 18:07:02 CST 2010


Hi Robert.
The solution was create a class IpLogger that inherit from logging.Logger
the new code us in repo.

Thanks

2010/12/11 Robert Kern <robert.kern@gmail.com>

> On 2010-12-11 12:47 , Omar Andrés Zapata Mesa wrote:
> > Hi all.
> > All suggestion of Brian, Fernando and Mirnk was wrotte in the code.
> > you can set optional colors, and default format too.
> >
> https://github.com/omazapa/ipython/blob/iplogging/IPython/utils/iplogging.py
> >
> > ex1:
> > In [1]: from iplogging import get_logger
> > In [2]: kernel_logger=get_logger(name="kernel")
> > In [3]: kernel_logger.debug("debug code here")
> > LOGGER: kernel
> > LEVEL: DEBUG
> > PROCESS: 5352
> > FILE: <ipython-input-3-39a714ce7396>
> > LINE: 1
> > MESSAGE: debug code here
> >
> > ex2:
> >
> > In [4]:
> >
> frontend_logger=get_logger(name="frontend",format="%(name)s\n%(levelname)s\n%(message)s\n",use_color=True)
> > In [3]: frontend_logger.debug("debug code here")
> >
> > output in http://gfifdev.udea.edu.co/IpythonLogging2.png
> >
> > Note that I put optional colors and format.
> >
> > Suggestions Please.
>
> One should not add Handlers or Formatters inside the IPython library code.
>
> http://docs.python.org/library/logging#configuring-logging-for-a-library
>
> The only place one ought to add Handlers or Formatters (except for a
> NullHandler) is at the main() level.
>
> --
> Robert Kern
>
> "I have come to believe that the whole world is an enigma, a harmless
> enigma
>  that is made terrible by our own mad attempt to interpret it as though it
> had
>  an underlying truth."
>   -- Umberto Eco
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>



-- 
Omar Andres Zapata Mesa
Head Developer Phenomenology of Fundamental Interactions Group (Gfif)
http://gfif.udea.edu.co
Division of computer science Gfif Developers (Gfif Dev)
http://gfifdev.udea.edu.co
Systems Engineering Student
Universidad de Antioquia At Medellin - Colombia
Usuario Linux  #490962
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-dev/attachments/20101211/abd812a8/attachment.html 


More information about the IPython-dev mailing list