File tree 3 files changed +25
-7
lines changed 3 files changed +25
-7
lines changed Original file line number Diff line number Diff line change 1
1
module github.com/u-root/uio
2
2
3
- go 1.15
3
+ go 1.16
4
4
5
5
require (
6
6
github.com/josharian/native v1.0.1-0.20221213033349-c1e37c09b531
Original file line number Diff line number Diff line change 9
9
// testing.TB.Logf. To use the test logger import "ulog/ulogtest".
10
10
package ulog
11
11
12
- import (
13
- "log"
14
- "os"
15
- )
12
+ import "log"
16
13
17
14
// Logger is a log receptacle.
18
15
//
@@ -22,8 +19,8 @@ type Logger interface {
22
19
Print (v ... interface {})
23
20
}
24
21
25
- // Log is a Logger that prints to stderr, like the default log package.
26
- var Log Logger = log .New ( os . Stderr , "" , log . LstdFlags )
22
+ // Log is a Logger that prints to the log package's default logger .
23
+ var Log Logger = log .Default ( )
27
24
28
25
type emptyLogger struct {}
29
26
Original file line number Diff line number Diff line change
1
+ package ulog
2
+
3
+ import (
4
+ "log"
5
+ "strings"
6
+ "testing"
7
+ )
8
+
9
+ func TestDefault (t * testing.T ) {
10
+ var b strings.Builder
11
+ log .SetPrefix ("[foobar] " )
12
+ log .SetOutput (& b )
13
+ log .SetFlags (0 )
14
+
15
+ Log .Printf ("Some output" )
16
+
17
+ want := "[foobar] Some output\n "
18
+ if got := b .String (); got != want {
19
+ t .Errorf ("log is %q, want %q" , got , want )
20
+ }
21
+ }
You can’t perform that action at this time.
0 commit comments