@@ -14,6 +14,9 @@ func tests() {
14
14
slog .Info ("msg" , "foo" , 1 , "bar" , 2 )
15
15
slog .Info ("msg" , slog .Int ("foo" , 1 ))
16
16
slog .Info ("msg" , slog .Int ("foo" , 1 ), slog .Int ("bar" , 2 ))
17
+ slog .With ("foo" , 1 , "bar" , 2 ).Info ("msg" )
18
+ slog .With (slog .Int ("foo" , 1 )).Info ("msg" )
19
+ slog .With (slog .Int ("foo" , 1 ), slog .Int ("bar" , 2 )).Info ("msg" )
17
20
18
21
slog .Log (ctx , slog .LevelInfo , "msg" , "foo" , 1 , slog .Int ("bar" , 2 )) // want `key-value pairs and attributes should not be mixed`
19
22
slog .Debug ("msg" , "foo" , 1 , slog .Int ("bar" , 2 )) // want `key-value pairs and attributes should not be mixed`
@@ -24,14 +27,17 @@ func tests() {
24
27
slog .InfoContext (ctx , "msg" , "foo" , 1 , slog .Int ("bar" , 2 )) // want `key-value pairs and attributes should not be mixed`
25
28
slog .WarnContext (ctx , "msg" , "foo" , 1 , slog .Int ("bar" , 2 )) // want `key-value pairs and attributes should not be mixed`
26
29
slog .ErrorContext (ctx , "msg" , "foo" , 1 , slog .Int ("bar" , 2 )) // want `key-value pairs and attributes should not be mixed`
30
+ slog .With ("foo" , 1 , slog .Int ("bar" , 2 )).ErrorContext (ctx , "msg" ) // want `key-value pairs and attributes should not be mixed`
27
31
28
- logger .Log (ctx , slog .LevelInfo , "msg" , "foo" , 1 , slog .Int ("bar" , 2 )) // want `key-value pairs and attributes should not be mixed`
29
- logger .Debug ("msg" , "foo" , 1 , slog .Int ("bar" , 2 )) // want `key-value pairs and attributes should not be mixed`
30
- logger .Info ("msg" , "foo" , 1 , slog .Int ("bar" , 2 )) // want `key-value pairs and attributes should not be mixed`
31
- logger .Warn ("msg" , "foo" , 1 , slog .Int ("bar" , 2 )) // want `key-value pairs and attributes should not be mixed`
32
- logger .Error ("msg" , "foo" , 1 , slog .Int ("bar" , 2 )) // want `key-value pairs and attributes should not be mixed`
33
- logger .DebugContext (ctx , "msg" , "foo" , 1 , slog .Int ("bar" , 2 )) // want `key-value pairs and attributes should not be mixed`
34
- logger .InfoContext (ctx , "msg" , "foo" , 1 , slog .Int ("bar" , 2 )) // want `key-value pairs and attributes should not be mixed`
35
- logger .WarnContext (ctx , "msg" , "foo" , 1 , slog .Int ("bar" , 2 )) // want `key-value pairs and attributes should not be mixed`
36
- logger .ErrorContext (ctx , "msg" , "foo" , 1 , slog .Int ("bar" , 2 )) // want `key-value pairs and attributes should not be mixed`
32
+ logger .Log (ctx , slog .LevelInfo , "msg" , "foo" , 1 , slog .Int ("bar" , 2 )) // want `key-value pairs and attributes should not be mixed`
33
+ logger .Debug ("msg" , "foo" , 1 , slog .Int ("bar" , 2 )) // want `key-value pairs and attributes should not be mixed`
34
+ logger .Info ("msg" , "foo" , 1 , slog .Int ("bar" , 2 )) // want `key-value pairs and attributes should not be mixed`
35
+ logger .Warn ("msg" , "foo" , 1 , slog .Int ("bar" , 2 )) // want `key-value pairs and attributes should not be mixed`
36
+ logger .Error ("msg" , "foo" , 1 , slog .Int ("bar" , 2 )) // want `key-value pairs and attributes should not be mixed`
37
+ logger .DebugContext (ctx , "msg" , "foo" , 1 , slog .Int ("bar" , 2 )) // want `key-value pairs and attributes should not be mixed`
38
+ logger .InfoContext (ctx , "msg" , "foo" , 1 , slog .Int ("bar" , 2 )) // want `key-value pairs and attributes should not be mixed`
39
+ logger .WarnContext (ctx , "msg" , "foo" , 1 , slog .Int ("bar" , 2 )) // want `key-value pairs and attributes should not be mixed`
40
+ logger .ErrorContext (ctx , "msg" , "foo" , 1 , slog .Int ("bar" , 2 )) // want `key-value pairs and attributes should not be mixed`
41
+ logger .With ("foo" , 1 , slog .Int ("bar" , 2 )).ErrorContext (ctx , "msg" ) // want `key-value pairs and attributes should not be mixed`
42
+ logger .With ("foo" , 1 ).ErrorContext (ctx , "msg" , "foo" , 1 , slog .Int ("bar" , 2 )) // want `key-value pairs and attributes should not be mixed`
37
43
}
0 commit comments