blob: 4cddd616275bfb3e873c038ff677ec5b5696be10 [file] [log] [blame]
Tim Windelschmidt6d33a432025-02-04 14:34:25 +01001// Copyright The Monogon Project Authors.
2// SPDX-License-Identifier: Apache-2.0
3
Serge Bazanski05f813b2023-03-16 17:58:39 +01004package launch
5
6import (
7 "fmt"
8 "os"
9 "strings"
10)
11
12// Log is compatible with the output of ConciseString as used in the Metropolis
13// console log, making the output more readable in unified test logs.
14func Log(f string, args ...any) {
15 formatted := fmt.Sprintf(f, args...)
16 for i, line := range strings.Split(formatted, "\n") {
17 if len(line) == 0 {
18 continue
19 }
20 if i == 0 {
21 fmt.Printf("TT| %20s ! %s\n", "test launch", line)
22 } else {
23 fmt.Printf("TT| %20s | %s\n", "", line)
24 }
25 }
26}
27
28func Fatal(f string, args ...any) {
29 Log(f, args...)
30 os.Exit(1)
31}