Use 🛑 (red octagonal stop sign) for ERROR prefix
❌ is a thin black-and-white cross that gets lost against terminal backgrounds and the ANSI red text. 🛑 is a solid red octagon that reads unmistakably as 'stop/error' at a glance, even when the user isn't reading the line carefully.
This commit is contained in:
@@ -405,7 +405,7 @@ Message classes:
|
|||||||
| Info | `》` (white) | column 0 | Neutral status update |
|
| Info | `》` (white) | column 0 | Neutral status update |
|
||||||
| Notice | `》` (cyan) | column 0 | Important note that is not a warning |
|
| Notice | `》` (cyan) | column 0 | Important note that is not a warning |
|
||||||
| Warning | `⚠️ Warning:` (orange/yellow) | column 0 | Recoverable problem |
|
| Warning | `⚠️ Warning:` (orange/yellow) | column 0 | Recoverable problem |
|
||||||
| Error | `❌ ERROR:` (red) | column 0 | Operation aborted |
|
| Error | `🛑 ERROR:` (red) | column 0 | Operation aborted |
|
||||||
| Progress | ` 》` (white) | column 2 | Heartbeat or per-item status during a long-running operation |
|
| Progress | ` 》` (white) | column 2 | Heartbeat or per-item status during a long-running operation |
|
||||||
|
|
||||||
Conventions:
|
Conventions:
|
||||||
|
|||||||
@@ -119,11 +119,11 @@ func (w *Writer) Warning(format string, args ...any) {
|
|||||||
_, _ = fmt.Fprintln(w.out, prefix+fmt.Sprintf(format, args...))
|
_, _ = fmt.Fprintln(w.out, prefix+fmt.Sprintf(format, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error prints "❌ ERROR: " in red followed by the message. Goes to the
|
// Error prints "🛑 ERROR: " in red followed by the message. Goes to the
|
||||||
// same writer as everything else; callers that want stderr should
|
// same writer as everything else; callers that want stderr should
|
||||||
// construct a separate Writer for it.
|
// construct a separate Writer for it.
|
||||||
func (w *Writer) Error(format string, args ...any) {
|
func (w *Writer) Error(format string, args ...any) {
|
||||||
prefix := "❌ " + w.paint(ansiRed+ansiBold, "ERROR: ")
|
prefix := "🛑 " + w.paint(ansiRed+ansiBold, "ERROR: ")
|
||||||
_, _ = fmt.Fprintln(w.out, prefix+fmt.Sprintf(format, args...))
|
_, _ = fmt.Fprintln(w.out, prefix+fmt.Sprintf(format, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ func TestMessageMethodsPlain(t *testing.T) {
|
|||||||
{"Info", func(w *Writer) { w.Info("status") }, "》 status\n"},
|
{"Info", func(w *Writer) { w.Info("status") }, "》 status\n"},
|
||||||
{"Notice", func(w *Writer) { w.Notice("note") }, "》 note\n"},
|
{"Notice", func(w *Writer) { w.Notice("note") }, "》 note\n"},
|
||||||
{"Warning", func(w *Writer) { w.Warning("oops") }, "⚠️ Warning: oops\n"},
|
{"Warning", func(w *Writer) { w.Warning("oops") }, "⚠️ Warning: oops\n"},
|
||||||
{"Error", func(w *Writer) { w.Error("boom") }, "❌ ERROR: boom\n"},
|
{"Error", func(w *Writer) { w.Error("boom") }, "🛑 ERROR: boom\n"},
|
||||||
{"Progress", func(w *Writer) { w.Progress("p") }, " 》 p\n"},
|
{"Progress", func(w *Writer) { w.Progress("p") }, " 》 p\n"},
|
||||||
{"Banner", func(w *Writer) { w.Banner("hello") }, "hello\n"},
|
{"Banner", func(w *Writer) { w.Banner("hello") }, "hello\n"},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user