.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_basic/11_logging_mesages.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_basic_11_logging_mesages.py: ==================== Logging and debuging ==================== .. GENERATED FROM PYTHON SOURCE LINES 7-29 .. code-block:: Python import logging import spydrnet as sdn logger = logging.getLogger("spydrnet_logs") logger.info("This is information") logger.debug("This is debug message") logger.warning("This is warning message") # Turn on logging in file, and set LOG LEVEL sdn.enable_file_logging(LOG_LEVEL="INFO", filename="execution_log_file") logger.info("file: This is information") logger.debug("file: This is debug message") logger.warning("file: This is warning message") # Dynamically turn on DEBUG for part of code logger.handlers[1].setLevel(logging.DEBUG) logger.info("Dynamic: This is information") logger.debug("Dynamic: This is debug message") logger.warning("Dynamic: This is warning message") logger.handlers[1].setLevel(logging.INFO) .. GENERATED FROM PYTHON SOURCE LINES 30-34 **Output log file** (*_execution_log_file_spydrnet.log*) .. literalinclude:: ../../../examples/basic/_execution_log_file_spydrnet.log .. _sphx_glr_download_auto_basic_11_logging_mesages.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 11_logging_mesages.ipynb <11_logging_mesages.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 11_logging_mesages.py <11_logging_mesages.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 11_logging_mesages.zip <11_logging_mesages.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_