[IPython-user] ask help for "Effective logging"

Fernando Perez Fernando.Perez at colorado.edu
Wed Jan 18 00:49:32 CST 2006


Elrania wrote:
> hello, I am a newbie of IPython.
> when i read the manual, Secton 4.2's label is Effective logging.
> It looks interesting, but I don't know how to use it in ipython.
> could anybody here give me a hand? thanks in advance.

The idea is to make an ipython 'profile' with the contents indicated in the
manual.  IPython profiles are explained here:

http://ipython.scipy.org/doc/manual/node7.html#SECTION00073000000000000000

So let's say that you want to make a profile called 'autolog' using Robert's
trick.  You would then need to make a file named

~/.ipython/ipythonrc-autolog

which would contain:

include ipythonrc
logfile '' # cancel earlier logfile invocation
execute import time
execute __cmd = 'PUT_SOME_PATH_YOU_WANT_HERE-%s.log rotate'
execute __IP.magic_logstart(__cmd % time.strftime('%Y-%m-%d'))


Then, you'd simply call ipython using this profile as

ipython -p autolog

at the command line.  If you end up using this very frequently, you can alias
it witha convenient name of your choosing.

I hope this helps.

Regards,

f




More information about the IPython-user mailing list