blob: 0e0aa34d0e4409890ac62c384e5af696befd6721 [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
Patrick Williams44b3caf2024-04-12 16:51:14 -050010import sys, logging
Patrick Williamsc124f4f2015-09-15 14:41:29 -050011
12def init_logger(logfile, loglevel):
13 numeric_level = getattr(logging, loglevel.upper(), None)
14 if not isinstance(numeric_level, int):
Patrick Williams44b3caf2024-04-12 16:51:14 -050015 raise ValueError("Invalid log level: %s" % loglevel)
16 FORMAT = "%(asctime)-15s %(message)s"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050017 logging.basicConfig(level=numeric_level, filename=logfile, format=FORMAT)
18
19class NotFoundError(Exception):
20 pass