<commit_before># -*- coding: utf-8 -*-
"""
    pyvisa
    ~~~~~~

    Python wrapper of National Instrument (NI) Virtual Instruments Software
    Architecture library (VISA).

    This file is part of PyVISA.

    :copyright: 2014 by PyVISA Authors, see AUTHORS for more details.
    :license: MIT, see LICENSE for more details.
"""

from __future__ import division, unicode_literals, print_function, absolute_import

import logging
import pkg_resources

from . import compat
logger = logging.getLogger('pyvisa')
logger.addHandler(compat.NullHandler())


def log_to_screen(level=logging.DEBUG):
    logger.setLevel(level)
    ch = logging.StreamHandler()
    ch.setLevel(level)

    formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')

    ch.setFormatter(formatter)

    logger.addHandler(ch)


__version__ = "unknown"
try:                # pragma: no cover
    __version__ = pkg_resources.get_distribution('pyvisa').version
except:             # pragma: no cover
    pass  # we seem to have a local copy without any repository control or installed without setuptools
          # so the reported version will be __unknown__


from .highlevel import ResourceManager
from .errors import (Error, VisaIOError, VisaIOWarning, VisaTypeError,
                     UnknownHandler, OSNotSupported, InvalidBinaryFormat,
                     InvalidSession, LibraryError)
# This is needed to registry all resources.
from .resources import Resource<commit_msg>Added possibility to redirect logging to file<commit_after># -*- coding: utf-8 -*-
"""
    pyvisa
    ~~~~~~

    Python wrapper of National Instrument (NI) Virtual Instruments Software
    Architecture library (VISA).

    This file is part of PyVISA.

    :copyright: 2014 by PyVISA Authors, see AUTHORS for more details.
    :license: MIT, see LICENSE for more details.
"""

from __future__ import division, unicode_literals, print_function, absolute_import

import logging
import pkg_resources

from . import compat
logger = logging.getLogger('pyvisa')
logger.addHandler(compat.NullHandler())


def log_to_screen(level=logging.DEBUG):
    log(None, level) # sys.stderr by default

def log(stream_output, level=logging.DEBUG):
    logger.setLevel(level)
    ch = logging.StreamHandler(stream_output)
    ch.setLevel(level)

    formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')

    ch.setFormatter(formatter)

    logger.addHandler(ch)


__version__ = "unknown"
try:                # pragma: no cover
    __version__ = pkg_resources.get_distribution('pyvisa').version
except:             # pragma: no cover
    pass  # we seem to have a local copy without any repository control or installed without setuptools
          # so the reported version will be __unknown__


from .highlevel import ResourceManager
from .errors import (Error, VisaIOError, VisaIOWarning, VisaTypeError,
                     UnknownHandler, OSNotSupported, InvalidBinaryFormat,
                     InvalidSession, LibraryError)
# This is needed to registry all resources.
from .resources import Resource
{'fraction_non_alphanumeric': 0.08671824629271438, 'fraction_numerical': 0.003223726627981947, 'mean_word_length': 3.5036284470246732, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '3579759', 'n_tokens_mistral': 890, 'n_tokens_neox': 837, 'n_words': 275}