Browse Source

Add support for multi-line log messages

Alois Mahdal 6 years ago
parent
commit
be48a92bd3
1 changed files with 25 additions and 7 deletions
  1. 25
    7
      src/jat.sh.skel

+ 25
- 7
src/jat.sh.skel View File

516
     #
516
     #
517
     # Log internal error unrelated to SUT
517
     # Log internal error unrelated to SUT
518
     #
518
     #
519
-    local msg=$1
519
+    local line
520
+    local msg
521
+    local head=true
522
+    for line in "$@"; do
523
+        __jat__show_terror "$line"
524
+        $head || msg+=$'\n'; head=false
525
+        msg+="$line"
526
+    done
520
     echo "error" >> "$(__jat__sd_path "llog")"
527
     echo "error" >> "$(__jat__sd_path "llog")"
521
     echo "error" >> "$(__jat__sd_path "P.llog")"
528
     echo "error" >> "$(__jat__sd_path "P.llog")"
522
     __jat__log_event TEST_ERROR "$msg"
529
     __jat__log_event TEST_ERROR "$msg"
523
-    __jat__show_terror "$msg"
524
 }
530
 }
525
 
531
 
526
 jat__log_info() {
532
 jat__log_info() {
527
     #
533
     #
528
     # Log internal info unrelated to SUT
534
     # Log internal info unrelated to SUT
529
     #
535
     #
530
-    local msg=$1
536
+    local line
537
+    local msg
538
+    local head=true
539
+    for line in "$@"; do
540
+        __jat__show_tinfo "$line"
541
+        $head || msg+=$'\n'; head=false
542
+        msg+="$line"
543
+    done
531
     echo "info" >> "$(__jat__sd_path "llog")"
544
     echo "info" >> "$(__jat__sd_path "llog")"
532
     echo "info" >> "$(__jat__sd_path "P.llog")"
545
     echo "info" >> "$(__jat__sd_path "P.llog")"
533
     __jat__log_event SINFO "$msg"
546
     __jat__log_event SINFO "$msg"
534
-    __jat__show_tinfo "$msg"
535
 }
547
 }
536
 
548
 
537
 jat__log_warning() {
549
 jat__log_warning() {
538
     #
550
     #
539
     # Log internal error unrelated to SUT
551
     # Log internal error unrelated to SUT
540
     #
552
     #
541
-    local msg=$1
553
+    local line
554
+    local msg
555
+    local head=true
556
+    for line in "$@"; do
557
+        __jat__show_twarning "$line"
558
+        $head || msg+=$'\n'; head=false
559
+        msg+="$line"
560
+    done
542
     echo "warning" >> "$(__jat__sd_path "llog")"
561
     echo "warning" >> "$(__jat__sd_path "llog")"
543
     echo "warning" >> "$(__jat__sd_path "P.llog")"
562
     echo "warning" >> "$(__jat__sd_path "P.llog")"
544
     __jat__log_event TEST_WARNING "$msg"
563
     __jat__log_event TEST_WARNING "$msg"
545
-    __jat__show_twarning "$msg"
546
 }
564
 }
547
 
565
 
548
 jat__pass() {
566
 jat__pass() {
1281
     case $value in
1299
     case $value in
1282
         "") echo "    $name: ~" ;;
1300
         "") echo "    $name: ~" ;;
1283
         *)  echo "    $name: |-"
1301
         *)  echo "    $name: |-"
1284
-            echo "        $value" ;;
1302
+            sed "s/^/        /" <<<"$value" ;;
1285
     esac
1303
     esac
1286
 }
1304
 }
1287
 
1305