-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.go
More file actions
125 lines (99 loc) · 3.05 KB
/
default.go
File metadata and controls
125 lines (99 loc) · 3.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
package cliout
// defaultOutput is the package-level Output instance used by the convenience functions.
var defaultOutput = New()
// Default returns the package-level default Output instance.
// This can be used to access the full Output API without creating a new instance.
func Default() *Output {
return defaultOutput
}
// --- Package-level configuration functions ---
// SetLevel sets the minimum output level on the default output.
func SetLevel(l Level) {
defaultOutput.SetLevel(l)
}
// SetPrefix sets the prefix string on the default output.
func SetPrefix(p string) {
defaultOutput.SetPrefix(p)
}
// ClearPrefix removes the prefix from the default output.
func ClearPrefix() {
defaultOutput.ClearPrefix()
}
// SetPrefixColor sets the prefix color on the default output.
func SetPrefixColor(c Color) {
defaultOutput.SetPrefixColor(c)
}
// SetMessageColor sets the message color on the default output.
func SetMessageColor(c Color) {
defaultOutput.SetMessageColor(c)
}
// SetTheme sets the theme on the default output.
func SetTheme(t Theme) {
defaultOutput.SetTheme(t)
}
// SetColorEnabled enables or disables color on the default output.
func SetColorEnabled(enabled bool) {
defaultOutput.SetColorEnabled(enabled)
}
// Colorize wraps text with the given color, respecting the default output's
// color-enabled setting.
func Colorize(text string, c Color) string {
return defaultOutput.Colorize(text, c)
}
// --- Package-level output functions ---
// Info prints an info-level message.
func Info(msg string) {
defaultOutput.Info(msg)
}
// Infof prints a formatted info-level message.
func Infof(format string, a ...any) {
defaultOutput.Infof(format, a...)
}
// Debug prints a debug-level message.
func Debug(msg string) {
defaultOutput.Debug(msg)
}
// Debugf prints a formatted debug-level message.
func Debugf(format string, a ...any) {
defaultOutput.Debugf(format, a...)
}
// Trace prints a trace-level message.
func Trace(msg string) {
defaultOutput.Trace(msg)
}
// Tracef prints a formatted trace-level message.
func Tracef(format string, a ...any) {
defaultOutput.Tracef(format, a...)
}
// Warn prints a warn-level message.
func Warn(msg string) {
defaultOutput.Warn(msg)
}
// Warnf prints a formatted warn-level message.
func Warnf(format string, a ...any) {
defaultOutput.Warnf(format, a...)
}
// Error prints an error-level message.
func Error(msg string) {
defaultOutput.Error(msg)
}
// Errorf prints a formatted error-level message.
func Errorf(format string, a ...any) {
defaultOutput.Errorf(format, a...)
}
// Fatal prints an error-level message and then exits with code 1.
func Fatal(msg string) {
defaultOutput.Fatal(msg)
}
// Fatalf prints a formatted error-level message and then exits with code 1.
func Fatalf(format string, a ...any) {
defaultOutput.Fatalf(format, a...)
}
// Success prints a success message at info level using the theme's SuccessColor.
func Success(msg string) {
defaultOutput.Success(msg)
}
// Successf prints a formatted success message at info level.
func Successf(format string, a ...any) {
defaultOutput.Successf(format, a...)
}