mirror of
https://git.yoctoproject.org/poky
synced 2026-05-07 04:58:26 +00:00
bitbake: prserv: move code from __init__ to bitbake-prserv
This script was the only user of this code. (Bitbake rev: 19a5595e3f70d61fd6fa414f9fd5b413a02de37b) Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com> Cc: Joshua Watt <JPEWhacker@gmail.com> Cc: Tim Orling <ticotimo@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
48d38aef22
commit
5f99010e41
@@ -21,6 +21,13 @@ VERSION = "1.1.0"
|
||||
PRHOST_DEFAULT="0.0.0.0"
|
||||
PRPORT_DEFAULT=8585
|
||||
|
||||
def init_logger(logfile, loglevel):
|
||||
numeric_level = getattr(logging, loglevel.upper(), None)
|
||||
if not isinstance(numeric_level, int):
|
||||
raise ValueError("Invalid log level: %s" % loglevel)
|
||||
FORMAT = "%(asctime)-15s %(message)s"
|
||||
logging.basicConfig(level=numeric_level, filename=logfile, format=FORMAT)
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="BitBake PR Server. Version=%s" % VERSION,
|
||||
@@ -72,7 +79,7 @@ def main():
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
prserv.init_logger(os.path.abspath(args.log), args.loglevel)
|
||||
init_logger(os.path.abspath(args.log), args.loglevel)
|
||||
|
||||
if args.start:
|
||||
ret=prserv.serv.start_daemon(args.file, args.host, args.port, os.path.abspath(args.log), args.read_only)
|
||||
|
||||
@@ -5,16 +5,3 @@
|
||||
#
|
||||
|
||||
__version__ = "1.0.0"
|
||||
|
||||
import os, time
|
||||
import sys, logging
|
||||
|
||||
def init_logger(logfile, loglevel):
|
||||
numeric_level = getattr(logging, loglevel.upper(), None)
|
||||
if not isinstance(numeric_level, int):
|
||||
raise ValueError("Invalid log level: %s" % loglevel)
|
||||
FORMAT = "%(asctime)-15s %(message)s"
|
||||
logging.basicConfig(level=numeric_level, filename=logfile, format=FORMAT)
|
||||
|
||||
class NotFoundError(Exception):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user