MCPcopy
hub / github.com/caddyserver/caddy / TestCustomLog_loggerAllowed

Function TestCustomLog_loggerAllowed

logging_test.go:19–106  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

17import "testing"
18
19func TestCustomLog_loggerAllowed(t *testing.T) {
20 type fields struct {
21 BaseLog BaseLog
22 Include []string
23 Exclude []string
24 }
25 type args struct {
26 name string
27 isModule bool
28 }
29 tests := []struct {
30 name string
31 fields fields
32 args args
33 want bool
34 }{
35 {
36 name: "include",
37 fields: fields{
38 Include: []string{"foo"},
39 },
40 args: args{
41 name: "foo",
42 isModule: true,
43 },
44 want: true,
45 },
46 {
47 name: "exclude",
48 fields: fields{
49 Exclude: []string{"foo"},
50 },
51 args: args{
52 name: "foo",
53 isModule: true,
54 },
55 want: false,
56 },
57 {
58 name: "include and exclude",
59 fields: fields{
60 Include: []string{"foo"},
61 Exclude: []string{"foo"},
62 },
63 args: args{
64 name: "foo",
65 isModule: true,
66 },
67 want: false,
68 },
69 {
70 name: "include and exclude (longer namespace)",
71 fields: fields{
72 Include: []string{"foo.bar"},
73 Exclude: []string{"foo"},
74 },
75 args: args{
76 name: "foo.bar",

Callers

nothing calls this directly

Calls 1

loggerAllowedMethod · 0.95

Tested by

no test coverage detected