diff options
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/logging.bbclass | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/meta/classes/logging.bbclass b/meta/classes/logging.bbclass index 6b24839af5..06c7c31c3e 100644 --- a/meta/classes/logging.bbclass +++ b/meta/classes/logging.bbclass | |||
@@ -9,34 +9,54 @@ LOGFIFO = "${T}/fifo.${@os.getpid()}" | |||
9 | # tasks that should be seen on the console. Use sparingly. | 9 | # tasks that should be seen on the console. Use sparingly. |
10 | # Output: logs console | 10 | # Output: logs console |
11 | bbplain() { | 11 | bbplain() { |
12 | printf "%b\0" "bbplain $*" > ${LOGFIFO} | 12 | if [ -p ${LOGFIFO} ] ; then |
13 | printf "%b\0" "bbplain $*" > ${LOGFIFO} | ||
14 | else | ||
15 | echo "$*" | ||
16 | fi | ||
13 | } | 17 | } |
14 | 18 | ||
15 | # Notify the user of a noteworthy condition. | 19 | # Notify the user of a noteworthy condition. |
16 | # Output: logs | 20 | # Output: logs |
17 | bbnote() { | 21 | bbnote() { |
18 | printf "%b\0" "bbnote $*" > ${LOGFIFO} | 22 | if [ -p ${LOGFIFO} ] ; then |
23 | printf "%b\0" "bbnote $*" > ${LOGFIFO} | ||
24 | else | ||
25 | echo "NOTE: $*" | ||
26 | fi | ||
19 | } | 27 | } |
20 | 28 | ||
21 | # Print a warning to the log. Warnings are non-fatal, and do not | 29 | # Print a warning to the log. Warnings are non-fatal, and do not |
22 | # indicate a build failure. | 30 | # indicate a build failure. |
23 | # Output: logs console | 31 | # Output: logs console |
24 | bbwarn() { | 32 | bbwarn() { |
25 | printf "%b\0" "bbwarn $*" > ${LOGFIFO} | 33 | if [ -p ${LOGFIFO} ] ; then |
34 | printf "%b\0" "bbwarn $*" > ${LOGFIFO} | ||
35 | else | ||
36 | echo "WARNING: $*" | ||
37 | fi | ||
26 | } | 38 | } |
27 | 39 | ||
28 | # Print an error to the log. Errors are non-fatal in that the build can | 40 | # Print an error to the log. Errors are non-fatal in that the build can |
29 | # continue, but they do indicate a build failure. | 41 | # continue, but they do indicate a build failure. |
30 | # Output: logs console | 42 | # Output: logs console |
31 | bberror() { | 43 | bberror() { |
32 | printf "%b\0" "bberror $*" > ${LOGFIFO} | 44 | if [ -p ${LOGFIFO} ] ; then |
45 | printf "%b\0" "bberror $*" > ${LOGFIFO} | ||
46 | else | ||
47 | echo "ERROR: $*" | ||
48 | fi | ||
33 | } | 49 | } |
34 | 50 | ||
35 | # Print a fatal error to the log. Fatal errors indicate build failure | 51 | # Print a fatal error to the log. Fatal errors indicate build failure |
36 | # and halt the build, exiting with an error code. | 52 | # and halt the build, exiting with an error code. |
37 | # Output: logs console | 53 | # Output: logs console |
38 | bbfatal() { | 54 | bbfatal() { |
39 | printf "%b\0" "bbfatal $*" > ${LOGFIFO} | 55 | if [ -p ${LOGFIFO} ] ; then |
56 | printf "%b\0" "bbfatal $*" > ${LOGFIFO} | ||
57 | else | ||
58 | echo "ERROR: $*" | ||
59 | fi | ||
40 | exit 1 | 60 | exit 1 |
41 | } | 61 | } |
42 | 62 | ||
@@ -44,7 +64,11 @@ bbfatal() { | |||
44 | # bitbake's UI. | 64 | # bitbake's UI. |
45 | # Output: logs console | 65 | # Output: logs console |
46 | bbfatal_log() { | 66 | bbfatal_log() { |
47 | printf "%b\0" "bbfatal_log $*" > ${LOGFIFO} | 67 | if [ -p ${LOGFIFO} ] ; then |
68 | printf "%b\0" "bbfatal_log $*" > ${LOGFIFO} | ||
69 | else | ||
70 | echo "ERROR: $*" | ||
71 | fi | ||
48 | exit 1 | 72 | exit 1 |
49 | } | 73 | } |
50 | 74 | ||
@@ -68,6 +92,10 @@ bbdebug() { | |||
68 | fi | 92 | fi |
69 | 93 | ||
70 | # All debug output is printed to the logs | 94 | # All debug output is printed to the logs |
71 | printf "%b\0" "bbdebug $DBGLVL $*" > ${LOGFIFO} | 95 | if [ -p ${LOGFIFO} ] ; then |
96 | printf "%b\0" "bbdebug $DBGLVL $*" > ${LOGFIFO} | ||
97 | else | ||
98 | echo "DEBUG: $*" | ||
99 | fi | ||
72 | } | 100 | } |
73 | 101 | ||