diff --git a/IPython/config/default/ipython_config.py b/IPython/config/default/ipython_config.py index 0047d2e..413c1e3 100644 --- a/IPython/config/default/ipython_config.py +++ b/IPython/config/default/ipython_config.py @@ -73,7 +73,7 @@ c.Global.log_level = 20 # c.InteractiveShell.logfile = 'ipython_log.py' -# c.InteractiveShell.logplay = 'mylog.py' +# c.InteractiveShell.logappend = 'mylog.py' # c.InteractiveShell.object_info_string_level = 0 diff --git a/IPython/core/ipapp.py b/IPython/core/ipapp.py index 9e56c3b..b8540c5 100644 --- a/IPython/core/ipapp.py +++ b/IPython/core/ipapp.py @@ -166,13 +166,13 @@ cl_args = ( ), (('-logfile','-lf'), dict( type=str, dest='InteractiveShell.logfile', default=NoConfigDefault, - help="Specify the name of your logfile.", + help="Start logging to logfile.", metavar='InteractiveShell.logfile') ), - (('-logplay','-lp'), dict( - type=str, dest='InteractiveShell.logplay', default=NoConfigDefault, - help="Re-play a log file and then append to it.", - metavar='InteractiveShell.logplay') + (('-logappend','-la'), dict( + type=str, dest='InteractiveShell.logappend', default=NoConfigDefault, + help="Start logging to logappend in append mode.", + metavar='InteractiveShell.logfile') ), (('-pdb',), dict( action='store_true', dest='InteractiveShell.pdb', default=NoConfigDefault, diff --git a/IPython/core/iplib.py b/IPython/core/iplib.py index c1bc026..cbcce45 100644 --- a/IPython/core/iplib.py +++ b/IPython/core/iplib.py @@ -209,7 +209,7 @@ class InteractiveShell(Component, Magic): ipythondir= Unicode('', config=True) # Set to get_ipython_dir() in __init__ logstart = CBool(False, config=True) logfile = Str('', config=True) - logplay = Str('', config=True) + logappend = Str('', config=True) object_info_string_level = Enum((0,1,2), default_value=0, config=True) pager = Str('less', config=True) @@ -466,20 +466,10 @@ class InteractiveShell(Component, Magic): self.logger = Logger(self, logfname='ipython_log.py', logmode='rotate') # local shortcut, this is used a LOT self.log = self.logger.log - # template for logfile headers. It gets resolved at runtime by the - # logstart method. - self.loghead_tpl = \ -"""#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE *** -#log# DO NOT CHANGE THIS LINE OR THE TWO BELOW -#log# opts = %s -#log# args = %s -#log# It is safe to make manual edits below here. -#log#----------------------------------------------------------------------- -""" def init_logstart(self): - if self.logplay: - self.magic_logstart(self.logplay + ' append') + if self.logappend: + self.magic_logstart(self.logappend + ' append') elif self.logfile: self.magic_logstart(self.logfile) elif self.logstart: diff --git a/IPython/core/magic.py b/IPython/core/magic.py index 678e2b0..d06c9ab 100644 --- a/IPython/core/magic.py +++ b/IPython/core/magic.py @@ -1154,10 +1154,8 @@ Currently the magic system has the following functions:\n""" if logfname: logfname = os.path.expanduser(logfname) self.shell.logfile = logfname - # TODO: we need to re-think how logs with args/opts are replayed - # and tracked. - # loghead = self.shell.loghead_tpl % (rc.opts,rc.args) - loghead = self.shell.loghead_tpl % ('','') + + loghead = '# IPython log file\n\n' try: started = logger.logstart(logfname,loghead,logmode, log_output,timestamp,log_raw_input)