<commit_before># -*- coding: utf-8 -*-
"""Helper functions for logging"""
from __future__ import absolute_import, division, unicode_literals
from functools import wraps
from future.utils import iteritems

import xbmc

from resources.lib.globals import g

__LOG_LEVEL__ = None


def get_log_level():
    """
    Lazily read the log level settings
    """
    # pylint: disable=global-statement
    global __LOG_LEVEL__
    if __LOG_LEVEL__ is None:
        try:
            __LOG_LEVEL__ = g.ADDON.getSettingString('debug_log_level')
        except Exception:  # pylint: disable=broad-except
            # If settings.xml was not created yet, as at first service run
            # g.ADDON.getSettingString('debug_log_level') will thrown a TypeError
            # If any other error appears, we don't want the service to crash,
            # let's return 'Disabled' in all case
            __LOG_LEVEL__ = 'Disabled'
    return __LOG_LEVEL__


def reset_log_level_global_var():
    """Reset log level global var, in order to update the value from settings"""
    # pylint: disable=global-statement
    global __LOG_LEVEL__
    __LOG_LEVEL__ = None


def _log(msg, level, *args, **kwargs):
    """Log a message to the Kodi logfile."""<commit_msg>Print to the log the logging level if enabled<commit_after># -*- coding: utf-8 -*-
"""Helper functions for logging"""
from __future__ import absolute_import, division, unicode_literals
from functools import wraps
from future.utils import iteritems

import xbmc

from resources.lib.globals import g

__LOG_LEVEL__ = None


def get_log_level():
    """
    Lazily read the log level settings
    """
    # pylint: disable=global-statement
    global __LOG_LEVEL__
    if __LOG_LEVEL__ is None:
        try:
            __LOG_LEVEL__ = g.ADDON.getSettingString('debug_log_level')
            if __LOG_LEVEL__ != 'Disabled':
                _log('Debug logging level is {}'.format(__LOG_LEVEL__), xbmc.LOGINFO)
        except Exception:  # pylint: disable=broad-except
            # If settings.xml was not created yet, as at first service run
            # g.ADDON.getSettingString('debug_log_level') will thrown a TypeError
            # If any other error appears, we don't want the service to crash,
            # let's return 'Disabled' in all case
            __LOG_LEVEL__ = 'Disabled'
    return __LOG_LEVEL__


def reset_log_level_global_var():
    """Reset log level global var, in order to update the value from settings"""
    # pylint: disable=global-statement
    global __LOG_LEVEL__
    __LOG_LEVEL__ = None


def _log(msg, level, *args, **kwargs):
    """Log a message to the Kodi logfile."""
{'fraction_non_alphanumeric': 0.08383685800604229, 'fraction_numerical': 0.0007552870090634441, 'mean_word_length': 3.0816640986132513, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7297059', 'n_tokens_mistral': 775, 'n_tokens_neox': 753, 'n_words': 262}