@@ -26,18 +26,12 @@ func init() {
26
26
}
27
27
28
28
func (c * Client ) logStdErr () {
29
- for {
30
- select {
31
- case e , more := <- c .writer :
32
- if e .level >= c .LogLevel {
33
- fmt .Fprintf (os .Stderr , "%s\t %s\t %s\t %s\n " , e .Timestamp .String (), e .Level , e .Output , e .File )
34
- }
35
- if ! more {
36
- stderrFinished <- true
37
- return
38
- }
29
+ for e := range c .writer {
30
+ if e .level >= c .LogLevel {
31
+ fmt .Fprintf (os .Stderr , "%s\t %s\t %s\t %s\n " , e .Timestamp .String (), e .Level , e .Output , e .File )
39
32
}
40
33
}
34
+ stderrFinished <- true
41
35
}
42
36
43
37
func CreateClient () * Client {
@@ -61,7 +55,7 @@ func Flush() {
61
55
func (c * Client ) Destroy () error {
62
56
var otherClients []* Client
63
57
if ! c .initialized {
64
- panic (errors .New ("Cannot delete uninitialized client, did you use CreateClient?" ))
58
+ panic (errors .New ("cannot delete uninitialized client, did you use CreateClient?" ))
65
59
}
66
60
sliceTex .Lock ()
67
61
c .writer = nil
@@ -78,7 +72,7 @@ func (c *Client) Destroy() error {
78
72
79
73
func (c * Client ) GetLogLevel () Level {
80
74
if ! c .initialized {
81
- panic (errors .New ("Cannot get level for uninitialized client, use CreateClient instead" ))
75
+ panic (errors .New ("cannot get level for uninitialized client, use CreateClient instead" ))
82
76
}
83
77
return c .LogLevel
84
78
}
@@ -109,14 +103,14 @@ func SetLogLevel(level Level) {
109
103
// SetLogLevel set log level of logger
110
104
func (c * Client ) SetLogLevel (level Level ) {
111
105
if ! c .initialized {
112
- panic (errors .New ("Cannot set level for uninitialized client, use CreateClient instead" ))
106
+ panic (errors .New ("cannot set level for uninitialized client, use CreateClient instead" ))
113
107
}
114
108
c .LogLevel = level
115
109
}
116
110
117
111
func (c * Client ) Get () Entry {
118
112
if ! c .initialized {
119
- panic (errors .New ("Cannot get logs for uninitialized client, did you use CreateClient?" ))
113
+ panic (errors .New ("cannot get logs for uninitialized client, did you use CreateClient?" ))
120
114
}
121
115
return <- c .writer
122
116
}
0 commit comments