Unverified Commit 2c81d49c authored by River WANG's avatar River WANG Committed by GitHub

fix a bug of terminal log printing

Fprint should be Fprintf
parent d5cb0508
...@@ -76,7 +76,7 @@ func CPrintf(color []byte, format string, args ...interface{}) { ...@@ -76,7 +76,7 @@ func CPrintf(color []byte, format string, args ...interface{}) {
func CPrintfln(color []byte, format string, args ...interface{}) { func CPrintfln(color []byte, format string, args ...interface{}) {
logStr := fmt.Sprintf(format, args...) logStr := fmt.Sprintf(format, args...)
if isatty.IsTerminal(os.Stdout.Fd()) { if isatty.IsTerminal(os.Stdout.Fd()) {
fmt.Fprint(os.Stdout, string(color)+funcFileLine()+"%s"+string(reset)+"\n", logStr) fmt.Fprintf(os.Stdout, string(color)+funcFileLine()+"%s"+string(reset)+"\n", logStr)
} else { } else {
fmt.Fprintf(os.Stdout, "%s\n", logStr) fmt.Fprintf(os.Stdout, "%s\n", logStr)
} }
...@@ -85,7 +85,7 @@ func CPrintfln(color []byte, format string, args ...interface{}) { ...@@ -85,7 +85,7 @@ func CPrintfln(color []byte, format string, args ...interface{}) {
func CEPrintf(color []byte, format string, args ...interface{}) { func CEPrintf(color []byte, format string, args ...interface{}) {
logStr := fmt.Sprintf(format, args...) logStr := fmt.Sprintf(format, args...)
if isatty.IsTerminal(os.Stdout.Fd()) { if isatty.IsTerminal(os.Stdout.Fd()) {
fmt.Fprint(os.Stderr, string(color)+funcFileLine()+"%s"+string(reset), logStr) fmt.Fprintf(os.Stderr, string(color)+funcFileLine()+"%s"+string(reset), logStr)
} else { } else {
fmt.Fprintf(os.Stderr, "%s", logStr) fmt.Fprintf(os.Stderr, "%s", logStr)
} }
...@@ -94,7 +94,7 @@ func CEPrintf(color []byte, format string, args ...interface{}) { ...@@ -94,7 +94,7 @@ func CEPrintf(color []byte, format string, args ...interface{}) {
func CEPrintfln(color []byte, format string, args ...interface{}) { func CEPrintfln(color []byte, format string, args ...interface{}) {
logStr := fmt.Sprintf(format, args...) logStr := fmt.Sprintf(format, args...)
if isatty.IsTerminal(os.Stdout.Fd()) { if isatty.IsTerminal(os.Stdout.Fd()) {
fmt.Fprint(os.Stderr, string(color)+funcFileLine()+"%s"+string(reset)+"\n", logStr) fmt.Fprintf(os.Stderr, string(color)+funcFileLine()+"%s"+string(reset)+"\n", logStr)
} else { } else {
fmt.Fprintf(os.Stderr, "%s\n", logStr) fmt.Fprintf(os.Stderr, "%s\n", logStr)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment