-
Notifications
You must be signed in to change notification settings - Fork 75
/
kdump.go
51 lines (40 loc) · 1.2 KB
/
kdump.go
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
// Package kdump like fmt.Println but more pretty and beautiful print Go values.
package kdump
import (
"io"
"os"
"github.com/gookit/goutil/dump"
)
var std = (KDumper)(*dump.Std())
func New() KDumper {
return (KDumper)(*dump.NewDumper(os.Stdout, 3))
}
// V like fmt.Println, but the output is clearer and more beautiful
func V(vs ...interface{}) {
std.Dump(vs...)
}
// P like fmt.Println, but the output is clearer and more beautiful
func P(vs ...interface{}) {
std.Print(vs...)
}
// Print like fmt.Println, but the output is clearer and more beautiful
func Print(vs ...interface{}) {
std.Print(vs...)
}
// Println like fmt.Println, but the output is clearer and more beautiful
func Println(vs ...interface{}) {
std.Println(vs...)
}
// Fprint like fmt.Println, but the output is clearer and more beautiful
func Fprint(w io.Writer, vs ...interface{}) {
std.Fprint(w, vs...)
}
// Format like fmt.Println, but the output is clearer and more beautiful
func Format(vs ...interface{}) string {
return std.Format(vs...)
}
// Custom method outside the original dump package
// FormatN like fmt.Println, but the output is clearer and no color
func FormatN(vs ...interface{}) string {
return std.FormatN(vs...)
}