Serge Bazanski | 05f813b | 2023-03-16 17:58:39 +0100 | [diff] [blame] | 1 | package launch |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | "os" |
| 6 | "strings" |
| 7 | ) |
| 8 | |
| 9 | // Log is compatible with the output of ConciseString as used in the Metropolis |
| 10 | // console log, making the output more readable in unified test logs. |
| 11 | func Log(f string, args ...any) { |
| 12 | formatted := fmt.Sprintf(f, args...) |
| 13 | for i, line := range strings.Split(formatted, "\n") { |
| 14 | if len(line) == 0 { |
| 15 | continue |
| 16 | } |
| 17 | if i == 0 { |
| 18 | fmt.Printf("TT| %20s ! %s\n", "test launch", line) |
| 19 | } else { |
| 20 | fmt.Printf("TT| %20s | %s\n", "", line) |
| 21 | } |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | func Fatal(f string, args ...any) { |
| 26 | Log(f, args...) |
| 27 | os.Exit(1) |
| 28 | } |