##// END OF EJS Templates
Minor changes to make sure logging is working well....
Brian Granger -
Show More
@@ -73,7 +73,7 b' c.Global.log_level = 20'
73 73
74 74 # c.InteractiveShell.logfile = 'ipython_log.py'
75 75
76 # c.InteractiveShell.logplay = 'mylog.py'
76 # c.InteractiveShell.logappend = 'mylog.py'
77 77
78 78 # c.InteractiveShell.object_info_string_level = 0
79 79
@@ -166,13 +166,13 b' cl_args = ('
166 166 ),
167 167 (('-logfile','-lf'), dict(
168 168 type=str, dest='InteractiveShell.logfile', default=NoConfigDefault,
169 help="Specify the name of your logfile.",
169 help="Start logging to logfile.",
170 170 metavar='InteractiveShell.logfile')
171 171 ),
172 (('-logplay','-lp'), dict(
173 type=str, dest='InteractiveShell.logplay', default=NoConfigDefault,
174 help="Re-play a log file and then append to it.",
175 metavar='InteractiveShell.logplay')
172 (('-logappend','-la'), dict(
173 type=str, dest='InteractiveShell.logappend', default=NoConfigDefault,
174 help="Start logging to logappend in append mode.",
175 metavar='InteractiveShell.logfile')
176 176 ),
177 177 (('-pdb',), dict(
178 178 action='store_true', dest='InteractiveShell.pdb', default=NoConfigDefault,
@@ -209,7 +209,7 b' class InteractiveShell(Component, Magic):'
209 209 ipythondir= Unicode('', config=True) # Set to get_ipython_dir() in __init__
210 210 logstart = CBool(False, config=True)
211 211 logfile = Str('', config=True)
212 logplay = Str('', config=True)
212 logappend = Str('', config=True)
213 213 object_info_string_level = Enum((0,1,2), default_value=0,
214 214 config=True)
215 215 pager = Str('less', config=True)
@@ -466,20 +466,10 b' class InteractiveShell(Component, Magic):'
466 466 self.logger = Logger(self, logfname='ipython_log.py', logmode='rotate')
467 467 # local shortcut, this is used a LOT
468 468 self.log = self.logger.log
469 # template for logfile headers. It gets resolved at runtime by the
470 # logstart method.
471 self.loghead_tpl = \
472 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
473 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
474 #log# opts = %s
475 #log# args = %s
476 #log# It is safe to make manual edits below here.
477 #log#-----------------------------------------------------------------------
478 """
479 469
480 470 def init_logstart(self):
481 if self.logplay:
482 self.magic_logstart(self.logplay + ' append')
471 if self.logappend:
472 self.magic_logstart(self.logappend + ' append')
483 473 elif self.logfile:
484 474 self.magic_logstart(self.logfile)
485 475 elif self.logstart:
@@ -1154,10 +1154,8 b' Currently the magic system has the following functions:\\n"""'
1154 1154 if logfname:
1155 1155 logfname = os.path.expanduser(logfname)
1156 1156 self.shell.logfile = logfname
1157 # TODO: we need to re-think how logs with args/opts are replayed
1158 # and tracked.
1159 # loghead = self.shell.loghead_tpl % (rc.opts,rc.args)
1160 loghead = self.shell.loghead_tpl % ('','')
1157
1158 loghead = '# IPython log file\n\n'
1161 1159 try:
1162 1160 started = logger.logstart(logfname,loghead,logmode,
1163 1161 log_output,timestamp,log_raw_input)
General Comments 0
You need to be logged in to leave comments. Login now