Logging of Sage sessions.

TODO: Pressing “control-D” can mess up the I/O sequence because of a known bug.

You can create a log of your Sage session as a web page and/or as a latex document. Just type log_html() to create an HTML log, or log_dvi() to create a dvi (LaTeX) log. Your complete session so far up until when you type the above command will be logged, along with any future input. Thus you can view the log system as a way to print or view your entire session so far, along with a way to see nicely typeset incremental updates as you work.

If L=log_dvi() or L=log_html() is a logger, you can type L.stop() and L.start() to stop and start logging.

The environment variables BROWSER and DVI_VIEWER determine which web browser or dvi viewer is used to display your running log.

For both log systems you must have a TeX system installed on your computer. For HTML logging, you must have the convert command, which comes with the free ImageMagick tools.

Note

The HTML output is done via LaTeX and PNG images right now, sort of like how latex2html works. Obviously it would be interesting to do something using MathML in the long run.

AUTHORS:

  • William Stein (2006-02): initial version
  • William Stein (2006-02-27): changed html generation so log directory is relocatable (no hardcoded paths).
  • William Stein (2006-03-04): changed environment variable to BROWSER.
  • Didier Deshommes (2006-05-06): added MathML support; refactored code.
  • Dan Drake (2008-03-27): fix bit rotting so that optional directories work, dvi logging works, viewer() command works, remove no-longer-working MathML logger; fix off-by-one problems with IPython history; add text logger; improve documentation about viewers.
class sage.misc.log.Log(dir=None, debug=False, viewer=None)

This is the base logger class. The two classes that you actually instantiate are derived from this one.

dir()
Return the directory that contains the log files.
start()
Start the logger. To stop use the stop function.
stop()
Stop the logger. To restart use the start function.
class sage.misc.log.log_dvi(dir=None, debug=False, viewer=None)

Bases: sage.misc.log.Log

Create a running log of your Sage session as a nicely typeset dvi file.

Easy usage: log_dvi()

TODO: Pressing “control-D” can mess up the I/O sequence because of a known bug.

Use L=log_dvi([optional directory]) to create a dvi log. Your complete session so far up until when you type the above command will be logged, along with any future input. Thus you can view the log system as a way to print or view your entire session so far, along with a way to see nicely typeset incremental updates as you work.

If L is a logger, you can type L.stop() and L.start() to stop and start logging.

The environment variable DVI_VIEWER determines which web browser or dvi viewer is used to display your running log. You can also specify a viewer when you start the logger with something like log_dvi([opt. dir], viewer='xdvi').

You must have a LaTeX system installed on your computer and a dvi viewer.

view()
class sage.misc.log.log_html(dir=None, debug=False, viewer=None)

Bases: sage.misc.log.Log

Create a running log of your Sage session as a web page.

Easy usage: log_html()

TODO: Pressing “control-D” can mess up the I/O sequence because of a known bug.

Use L=log_html([optional directory]) to create an HTML log. Your complete session so far up until when you type the above command will be logged, along with any future input. Thus you can view the log system as a way to print or view your entire session so far, along with a way to see nicely typeset incremental updates as you work.

If L is a logger, you can type L.stop() and L.start() to stop and start logging.

The environment variable WEB_BROWSER determines which web browser or dvi viewer is used to display your running log. You can also specify a viewer when you start the logger with something like log_html([opt. dir], viewer='firefox').

You must have a TeX system installed on your computer, and you must have the convert command, which comes with the free ImageMagick tools.

view()
class sage.misc.log.log_text(dir=None, debug=False, viewer=None)

Bases: sage.misc.log.Log

Create a running log of your Sage session as a plain text file.

Easy usage: log_text()

TODO: Pressing “control-D” can mess up the I/O sequence because of a known bug.

Use L=log_text([optional directory]) to create a text log. Your complete session so far up until when you type the above command will be logged, along with any future input. Thus you can view the log system as a way to print or view your entire session so far, along with a way to see incremental updates as you work.

Unlike the html and dvi loggers, this one does not automatically start a viewer unless you specify one; you can do that when you start the logger with something like log_text([opt. dir], viewer='xterm -e tail -f').

If L is a logger, you can type L.stop() and L.start() to stop and start logging.

view()
sage.misc.log.update()

Previous topic

Lazy imports

Next topic

Object persistence

This Page