I would like to always log ipython commandline and output to a file in append mode. On reading the file under .ipython/profile_default/startup README
$ cat README
This is the IPython startup directory
.py and .ipy files in this directory will be run *prior* to any code or files specified
via the exec_lines or exec_files configurables whenever you load this profile.
Files will be run in lexicographical order, so you can control the execution order of files
with a prefix, e.g.::
00-first.py
50-middle.py
99-last.ipy
I tried adding a file first.py with below contents
logstart -o -r -t logs/ipython.log 'append'
logstart is a magic command. I am getting below error when I am trying to start ipython
File "/home/mtk/.ipython/profile_default/startup/00-first.py", line 1
logstart -o -r -t logs/ipython.log 'append'
^
SyntaxError: invalid syntax
How to resolve this issue?
.ipyextension..pyfiles have to be regular Python code, without IPython special syntax.