blob: 38ced818ad3be910422610588e76be3c3cc00507 [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001#
Patrick Williams92b42cb2022-09-03 06:53:57 -05002# Copyright BitBake Contributors
3#
Brad Bishopc342db32019-05-15 21:57:59 -04004# SPDX-License-Identifier: GPL-2.0-only
5#
6
Patrick Williamsc124f4f2015-09-15 14:41:29 -05007__version__ = "1.0.0"
8
9import os, time
10import sys,logging
11
12def init_logger(logfile, loglevel):
13 numeric_level = getattr(logging, loglevel.upper(), None)
14 if not isinstance(numeric_level, int):
15 raise ValueError('Invalid log level: %s' % loglevel)
16 FORMAT = '%(asctime)-15s %(message)s'
17 logging.basicConfig(level=numeric_level, filename=logfile, format=FORMAT)
18
19class NotFoundError(Exception):
20 pass