[IPython-user] Log options at ipython startup

Gökhan Sever gokhansever@gmail....
Tue Jan 12 16:37:47 CST 2010

Here is what I have in my ipy_user_conf.py file:

def main():

        ldir = '/home/user/.ipython/'
        filename = os.path.join(ldir, strftime('%Y-%m-%d')+".py")
        notnew = os.path.exists(filename)
        ip.IP.logger.logstart(logfname=filename, logmode='append')
        if notnew:
            ip.IP.logger.log_write("# =================================")
            ip.IP.logger.log_write("""#!/usr/bin/env python \n# %s.py \n#
IPython automatic logging file""" % strftime('%Y-%m-%d'))
        ip.IP.logger.log_write("""# %s \n#
=================================""" % strftime('%H:%M'))
        print " Logging to "+filename

    except RuntimeError:
        print " Already logging to "+ip.IP.logger.logfname

I learnt this trick from Pierre Raybaut of PythonXY. There is a log file per
day and time-stamping per session. I am sure it could easily modified to log
everything in a file and with a time stamp if this is what you need.

On Tue, Jan 12, 2010 at 9:12 AM, gaubi <erwin.gaubitzer@univie.ac.at> wrote:

> In order to retrace my work I want to always have timestamping on.
> Is this possible using a commandline parameter or in a configuration file?
> Thanks
> Erwin
> --
> View this message in context:
> http://old.nabble.com/Log-options-at-ipython-startup-tp27129034p27129034.html
> Sent from the IPython - User mailing list archive at Nabble.com.
> _______________________________________________
> IPython-user mailing list
> IPython-user@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20100112/0a618dda/attachment.html 

More information about the IPython-user mailing list