Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Logging

Logging is supported by defeault through the logging standard python library. To generate logging output, a logger must be configured. This must be done before creating a LTM Session.

Basic logging to standard output

A basic configuration which logs to standard output can be seen below. When used in a Jupyter notebook, this will also display log messages below the currently executing cell.

import logging

logging.basicConfig(level=logging.INFO)

Log to file

The following will configure logging to a log file. Note the “filemode” argument, which by default is set to “a”, and will append. Setting it to “w” will cause the log to be truncated when the code is run.

import logging

logging.basicConfig(level=logging.INFO, filename="ltmapi.log", filemode="w")

For more info about how to use the logging library, see the documentation:

https://docs.python.org/3/library/logging.html#logging.basicConfig