diff options
Diffstat (limited to 'meta/classes-global/logging.bbclass')
| -rw-r--r-- | meta/classes-global/logging.bbclass | 117 |
1 files changed, 0 insertions, 117 deletions
diff --git a/meta/classes-global/logging.bbclass b/meta/classes-global/logging.bbclass deleted file mode 100644 index 136f1e1733..0000000000 --- a/meta/classes-global/logging.bbclass +++ /dev/null | |||
| @@ -1,117 +0,0 @@ | |||
| 1 | # | ||
| 2 | # Copyright OpenEmbedded Contributors | ||
| 3 | # | ||
| 4 | # SPDX-License-Identifier: MIT | ||
| 5 | # | ||
| 6 | |||
| 7 | # The following logging mechanisms are to be used in bash functions of recipes. | ||
| 8 | # They are intended to map one to one in intention and output format with the | ||
| 9 | # python recipe logging functions of a similar naming convention: bb.plain(), | ||
| 10 | # bb.note(), etc. | ||
| 11 | |||
| 12 | LOGFIFO = "${T}/fifo.${@os.getpid()}" | ||
| 13 | |||
| 14 | # Print the output exactly as it is passed in. Typically used for output of | ||
| 15 | # tasks that should be seen on the console. Use sparingly. | ||
| 16 | # Output: logs console | ||
| 17 | bbplain() { | ||
| 18 | if [ -p ${LOGFIFO} ] ; then | ||
| 19 | printf "%b\0" "bbplain $*" > ${LOGFIFO} | ||
| 20 | else | ||
| 21 | echo "$*" | ||
| 22 | fi | ||
| 23 | } | ||
| 24 | |||
| 25 | # Notify the user of a noteworthy condition. | ||
| 26 | # Output: logs | ||
| 27 | bbnote() { | ||
| 28 | if [ -p ${LOGFIFO} ] ; then | ||
| 29 | printf "%b\0" "bbnote $*" > ${LOGFIFO} | ||
| 30 | else | ||
| 31 | echo "NOTE: $*" | ||
| 32 | fi | ||
| 33 | } | ||
| 34 | |||
| 35 | # Notify the user of a noteworthy condition. | ||
| 36 | # Output: logs console | ||
| 37 | bbverbnote() { | ||
| 38 | if [ -p ${LOGFIFO} ]; then | ||
| 39 | printf "%b\0" "bbverbnote $*" > ${LOGFIFO} | ||
| 40 | else | ||
| 41 | echo "NOTE: $*" | ||
| 42 | fi | ||
| 43 | } | ||
| 44 | |||
| 45 | # Print a warning to the log. Warnings are non-fatal, and do not | ||
| 46 | # indicate a build failure. | ||
| 47 | # Output: logs console | ||
| 48 | bbwarn() { | ||
| 49 | if [ -p ${LOGFIFO} ] ; then | ||
| 50 | printf "%b\0" "bbwarn $*" > ${LOGFIFO} | ||
| 51 | else | ||
| 52 | echo "WARNING: $*" | ||
| 53 | fi | ||
| 54 | } | ||
| 55 | |||
| 56 | # Print an error to the log. Errors are non-fatal in that the build can | ||
| 57 | # continue, but they do indicate a build failure. | ||
| 58 | # Output: logs console | ||
| 59 | bberror() { | ||
| 60 | if [ -p ${LOGFIFO} ] ; then | ||
| 61 | printf "%b\0" "bberror $*" > ${LOGFIFO} | ||
| 62 | else | ||
| 63 | echo "ERROR: $*" | ||
| 64 | fi | ||
| 65 | } | ||
| 66 | |||
| 67 | # Print a fatal error to the log. Fatal errors indicate build failure | ||
| 68 | # and halt the build, exiting with an error code. | ||
| 69 | # Output: logs console | ||
| 70 | bbfatal() { | ||
| 71 | if [ -p ${LOGFIFO} ] ; then | ||
| 72 | printf "%b\0" "bbfatal $*" > ${LOGFIFO} | ||
| 73 | else | ||
| 74 | echo "ERROR: $*" | ||
| 75 | fi | ||
| 76 | exit 1 | ||
| 77 | } | ||
| 78 | |||
| 79 | # Like bbfatal, except prevents the suppression of the error log by | ||
| 80 | # bitbake's UI. | ||
| 81 | # Output: logs console | ||
| 82 | bbfatal_log() { | ||
| 83 | if [ -p ${LOGFIFO} ] ; then | ||
| 84 | printf "%b\0" "bbfatal_log $*" > ${LOGFIFO} | ||
| 85 | else | ||
| 86 | echo "ERROR: $*" | ||
| 87 | fi | ||
| 88 | exit 1 | ||
| 89 | } | ||
| 90 | |||
| 91 | # Print debug messages. These are appropriate for progress checkpoint | ||
| 92 | # messages to the logs. Depending on the debug log level, they may also | ||
| 93 | # go to the console. | ||
| 94 | # Output: logs console | ||
| 95 | # Usage: bbdebug 1 "first level debug message" | ||
| 96 | # bbdebug 2 "second level debug message" | ||
| 97 | bbdebug() { | ||
| 98 | USAGE='Usage: bbdebug [123] "message"' | ||
| 99 | if [ $# -lt 2 ]; then | ||
| 100 | bbfatal "$USAGE" | ||
| 101 | fi | ||
| 102 | |||
| 103 | # Strip off the debug level and ensure it is an integer | ||
| 104 | DBGLVL=$1; shift | ||
| 105 | NONDIGITS=$(echo "$DBGLVL" | tr -d "[:digit:]") | ||
| 106 | if [ "$NONDIGITS" ]; then | ||
| 107 | bbfatal "$USAGE" | ||
| 108 | fi | ||
| 109 | |||
| 110 | # All debug output is printed to the logs | ||
| 111 | if [ -p ${LOGFIFO} ] ; then | ||
| 112 | printf "%b\0" "bbdebug $DBGLVL $*" > ${LOGFIFO} | ||
| 113 | else | ||
| 114 | echo "DEBUG: $*" | ||
| 115 | fi | ||
| 116 | } | ||
| 117 | |||
