scriptutils: Add support for specify stream on logger_create

It is a good idea to let the script to choose what stream wants
to dump the logging output.

[YOCTO #11160]

(From OE-Core rev: 60c9b06f4085f6bddb6aa397a38bfc2ceb10f964)

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Aníbal Limón 2017-03-20 14:51:01 -06:00 committed by Richard Purdie
parent c8e8e50bc3
commit 15e65f5f07
1 changed files with 2 additions and 2 deletions

View File

@ -22,9 +22,9 @@ import glob
import argparse
import subprocess
def logger_create(name):
def logger_create(name, stream=None):
logger = logging.getLogger(name)
loggerhandler = logging.StreamHandler()
loggerhandler = logging.StreamHandler(stream=stream)
loggerhandler.setFormatter(logging.Formatter("%(levelname)s: %(message)s"))
logger.addHandler(loggerhandler)
logger.setLevel(logging.INFO)