<br><br><div class="gmail_quote">On Sat, Aug 6, 2011 at 14:43, Gökhan Sever <span dir="ltr"><<a href="mailto:gokhansever@gmail.com">gokhansever@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br>
<br>
You already have logging option in IPython. I forgot mentioning of<br>
this functionality before. When I look into the sqlite database, I<br>
couldn't see timestamps associated with commands. However the<br>
classical logging in IPython allows timestamping of commands.<br></blockquote><div><br></div><div>I've never used the IPython logging output, so I didn't know it had a timestamp :)</div><div><br></div><div>You are right that there are not timestamps associated with individual commands in the sqlite history, they are only associated with sessions as a whole. It would probably be valuable to add timestamps to individual commands as well. I believe I asked for this, but was outvoted, since it would add cost to each execution, and people would rarely be interested in the extra information.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
So far, the following options seems the best scenario for me for<br>
logging the activity in IPython.<br>
%logstart -t -r "ipy_log.txt" global<br>
<br>
What is the right place to put this magic just before I start typing?<br>
</blockquote><div><br></div><div>The right place is InteractiveShellApp.exec_lines in a config file:</div><div><br></div><div>c.InteractiveShellApp.exec_lines = ["%logstart -t -r 'ipy_log.txt' "] # or append, if you already have other lines</div>
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Also, can I get the same behavior via the command line interface?<br></blockquote><div><br>
</div><div>There's approximately nothing you can do in a config file that you can't on the command-line. The easiest way to start IPython with logging immediately from the command-line is:</div><div><br></div><div>
ipython -i --c="%logstart -t -r 'ipy_log.txt'"</div><div><br></div><div>'-c' is a shortcut for appending a single line to the end of exec_lines. The '-i' prevents IPython from exiting after running the command.</div>
<div><br></div><div>(you will get the natural '-c cmd' syntax back when PR #74 reinstates argparse for parsing)</div><div><br></div><div>-MinRK</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Thanks.<br>
<div><div></div><div class="h5"><br>
On Wed, Aug 3, 2011 at 10:03 PM, Gökhan Sever <<a href="mailto:gokhansever@gmail.com">gokhansever@gmail.com</a>> wrote:<br>
> Hello,<br>
><br>
> Finally, I get the new Ipython running. qtconsole is up too. I<br>
> installed v0.11 The very first thing I have noticed is there is not<br>
> .ipython folder under my home directory.<br>
><br>
> ipython -help and ipython -help-all provides a lot of reading for tomorrow :)<br>
><br>
> I have an alias in .bashrc as:<br>
> # fixed after getting a single dash deprecation warning for pylab<br>
> alias ii='ipython --pylab'<br>
><br>
> Now typing "ii"<br>
> WARNING: `-pylab` flag has been deprecated.<br>
> Use `--pylab` instead, or `--pylab=foo` to specify a backend.<br>
><br>
> Is this warning temporary?<br>
><br>
> Thanks for all your efforts and especially well-documenting the new changes.<br>
><br>
> More testing comes later...<br>
><br>
><br>
> On Wed, Aug 3, 2011 at 3:16 PM, Gökhan Sever <<a href="mailto:gokhansever@gmail.com">gokhansever@gmail.com</a>> wrote:<br>
>> Hi,<br>
>> I tend to log my sessions and index them via full-text searching tool called<br>
>> "recoll" along with many other files (indeed tons of them). Being able to<br>
>> have IPython history in the form of text would make my life easier since<br>
>> recoll can easily crawl text files. In addition, recoll has a command line<br>
>> tool to dump xapian database into a text file with some basic text<br>
>> statistics options. This way, I can easily get statistics about my most used<br>
>> Python commands and such.<br>
>> I plan to upgrade my beloved IPython v0.10 to the new release tonight. I<br>
>> will let you know how my experience goes with the new one. Hopefully, I will<br>
>> figure out a way to get text outputs from the sqlite saved logs.<br>
>> Thanks,<br>
>><br>
>> On Wed, Aug 3, 2011 at 9:30 AM, Thomas Kluyver <<a href="mailto:takowl@gmail.com">takowl@gmail.com</a>> wrote:<br>
>>><br>
>>> On 3 August 2011 16:02, Gökhan Sever <<a href="mailto:gokhansever@gmail.com">gokhansever@gmail.com</a>> wrote:<br>
>>>><br>
>>>> Thanks for the answer Thomas. Is there a way to dump the sqlite database<br>
>>>> to a text file? Since time-stamping automatically added in the database, I<br>
>>>> don't see a particular reason for using another logging mechanism.<br>
>>><br>
>>> There's no tool for that at present, but if you feel like writing one, it<br>
>>> shouldn't be too complex. The file is<br>
>>> .ipython/profile_default/history.sqlite. You can extract timestamps from the<br>
>>> session table, and then use the session number to select rows from the<br>
>>> history table (and the output_history table if you've turned on output<br>
>>> logging as well). In fact, you might be able to import IPython.core.history<br>
>>> to handle loading the database.<br>
>>><br>
>>> Thanks,<br>
>>> Thomas<br>
>><br>
>><br>
>><br>
>> --<br>
>> Gökhan<br>
>><br>
><br>
><br>
><br>
> --<br>
> Gökhan<br>
><br>
<br>
<br>
<br>
--<br>
Gökhan<br>
_______________________________________________<br>
IPython-User mailing list<br>
<a href="mailto:IPython-User@scipy.org">IPython-User@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-user" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-user</a><br>
</div></div></blockquote></div><br>