blob: 9961040b582ba57a737483602bdecc5251225acf [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001#
2# SPDX-License-Identifier: GPL-2.0-only
3#
4
Patrick Williamsc124f4f2015-09-15 14:41:29 -05005__version__ = "1.0.0"
6
7import os, time
8import sys,logging
9
10def init_logger(logfile, loglevel):
11 numeric_level = getattr(logging, loglevel.upper(), None)
12 if not isinstance(numeric_level, int):
13 raise ValueError('Invalid log level: %s' % loglevel)
14 FORMAT = '%(asctime)-15s %(message)s'
15 logging.basicConfig(level=numeric_level, filename=logfile, format=FORMAT)
16
17class NotFoundError(Exception):
18 pass