.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        Click :ref:`here <sphx_glr_download_auto_examples_plot_log.py>`     to download the full example code
    .. rst-class:: sphx-glr-example-title

    .. _sphx_glr_auto_examples_plot_log.py:


Logging test
============


.. code-block:: python3


    import logging
    import sys


    def _create_logger(name=None):
        logger = logging.getLogger(name=name)
        logger.setLevel(logging.INFO)
        sh = logging.StreamHandler(sys.stdout)
        sh.setLevel(logging.INFO)
        logger.addHandler(sh)
        return logger










.. code-block:: python3

    logger = _create_logger("first_logger")
    logger.info("is in the same cell")





.. rst-class:: sphx-glr-script-out

 Out:

 .. code-block:: none

    is in the same cell





.. code-block:: python3

    logger.info("is not in the same cell")




.. rst-class:: sphx-glr-script-out

 Out:

 .. code-block:: none

    is not in the same cell





.. rst-class:: sphx-glr-timing

   **Total running time of the script:** ( 0 minutes  0.002 seconds)


.. _sphx_glr_download_auto_examples_plot_log.py:


.. only :: html

 .. container:: sphx-glr-footer
    :class: sphx-glr-footer-example



  .. container:: sphx-glr-download sphx-glr-download-python

     :download:`Download Python source code: plot_log.py <plot_log.py>`



  .. container:: sphx-glr-download sphx-glr-download-jupyter

     :download:`Download Jupyter notebook: plot_log.ipynb <plot_log.ipynb>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
