diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2017-03-27 13:17:27 +1300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-27 20:23:19 +0100 |
commit | 614cbeddc8f092bf2748ae7555d62467f3c45f16 (patch) | |
tree | e514a07f2b452a9314461798e0b86e3f0b0ca682 /bitbake/bin/bitbake-dumpsig | |
parent | f41740ee8ee91a57f22ce7fa2a4b8ceeea78de0d (diff) | |
download | poky-614cbeddc8f092bf2748ae7555d62467f3c45f16.tar.gz |
bitbake: lib/bb/msg: introduce logger_create() function
We use this code to set up a logger with colour in a number of different
places, so create one function that does this and make some of bitbake's
utility scripts use it.
(Bitbake rev: b1ba7d1cc8ec33e2d081230287abd07f52136097)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/bin/bitbake-dumpsig')
-rwxr-xr-x | bitbake/bin/bitbake-dumpsig | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/bitbake/bin/bitbake-dumpsig b/bitbake/bin/bitbake-dumpsig index 38efd22864..95ebd93546 100755 --- a/bitbake/bin/bitbake-dumpsig +++ b/bitbake/bin/bitbake-dumpsig | |||
@@ -29,19 +29,9 @@ sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), ' | |||
29 | 29 | ||
30 | import bb.tinfoil | 30 | import bb.tinfoil |
31 | import bb.siggen | 31 | import bb.siggen |
32 | import bb.msg | ||
32 | 33 | ||
33 | def logger_create(name, output=sys.stderr): | 34 | logger = bb.msg.logger_create('bitbake-dumpsig') |
34 | logger = logging.getLogger(name) | ||
35 | console = logging.StreamHandler(output) | ||
36 | format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s") | ||
37 | if output.isatty(): | ||
38 | format.enable_color() | ||
39 | console.setFormatter(format) | ||
40 | logger.addHandler(console) | ||
41 | logger.setLevel(logging.INFO) | ||
42 | return logger | ||
43 | |||
44 | logger = logger_create('bitbake-dumpsig') | ||
45 | 35 | ||
46 | def find_siginfo_task(bbhandler, pn, taskname): | 36 | def find_siginfo_task(bbhandler, pn, taskname): |
47 | """ Find the most recent signature file for the specified PN/task """ | 37 | """ Find the most recent signature file for the specified PN/task """ |