Skip to content

Commit 37cb8d8

Browse files
committed
#### Version 0.9.7
* New Feature: add dotlog.SprintSpacing to formats using the default formats * 2019-06-14 10:00
1 parent 5aca71a commit 37cb8d8

3 files changed

Lines changed: 25 additions & 0 deletions

File tree

dotlog.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
package dotlog
22

3+
import (
4+
"fmt"
5+
"strings"
6+
)
7+
38
func GetLogger(name string) Logger {
49
if logger, exists := GlobalLoggerMap[name]; !exists {
510
return EmptyLogger()
611
} else {
712
return logger
813
}
914
}
15+
16+
// SprintSpacing formats using the default formats for its operands and returns the resulting string.
17+
// Spaces are always added between operands.
18+
func SprintSpacing(a ...interface{}) string {
19+
return strings.TrimSuffix(fmt.Sprintln(a...), "\n")
20+
}

dotlog_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,13 @@ func Test_GetLogger(t *testing.T) {
1212
log1 := GetLogger("log1")
1313
fmt.Println(log1.LoggerName())
1414
}
15+
16+
func Test_SprintSpacing(t *testing.T) {
17+
checkResult := "a 1 b true"
18+
toCheck := SprintSpacing("a", 1, "b", true)
19+
if checkResult == toCheck {
20+
t.Log("CHECK SUCCESS:", toCheck, checkResult)
21+
} else {
22+
t.Error("CHECK ERROR:", toCheck, checkResult)
23+
}
24+
}

version.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## dotlog版本记录:
22

3+
#### Version 0.9.7
4+
* New Feature: add dotlog.SprintSpacing to formats using the default formats
5+
* 2019-06-14 10:00
6+
37
#### Version 0.9.6
48
* Bug fixed: use "Logger.Layout" set info if you config it and use config mode
59
* 2018-11-02 19:00

0 commit comments

Comments
 (0)