#
# Utility classes for working with the logger
#
import sys
import logging
from logging.handlers import RotatingFileHandler

_fh = RotatingFileHandler(
    'log/simsdt_app_monitor.log', maxBytes=1024*50, backupCount=10, encoding='utf-8')
_fmt = logging.Formatter(
    '%(asctime)s - %(name)s - %(levelname)s - %(message)s', datefmt='%Y-%m-%dT%H:%M:%S')
_fh.setFormatter(_fmt)
_fh.setLevel(logging.INFO)

logger = logging.getLogger('spr')
logger.addHandler(_fh)
logger.setLevel(logging.INFO)


class NullStream:
    """
    A file like class that writes nothing
    """

    def close(self): pass
    def flush(self): pass
    def write(self, str): pass
    def writelines(self, sequence): pass
