# encoding: utf-8

"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""

from __future__ import absolute_import
from __future__ import unicode_literals

import logbook


LOG_FORMAT_STRING = "[{record.level_name}] {record.channel}: {record.message}"


logger = logbook.Logger("DataProperty")
logger.disable()


def set_logger(is_enable):
    if is_enable:
        logger.enable()
    else:
        logger.disable()


def set_log_level(log_level):
    """
    Set logging level of this module. The module using
    `logbook <http://logbook.readthedocs.io/en/stable/>`__ module for logging.

    :param int log_level:
        One of the log level of the
        `logbook <http://logbook.readthedocs.io/en/stable/api/base.html>`__.
        Disabled logging if the ``log_level`` is ``logbook.NOTSET``.
    """

    # validate log level
    logbook.get_level_name(log_level)

    if log_level == logbook.NOTSET:
        set_logger(is_enable=False)
    else:
        set_logger(is_enable=True)
        logger.level = log_level

@@ -882,16 +882,66 @@
 level)%0A%0A
+    if log_level == logger.level:%0A        return%0A%0A
     if l
@@ -1049,20 +1049,17 @@
 e=True)%0A
-    
+%0A
     logg

Improve logging setup