MatchesPaths implements Selector.
(paths []string)
| 59 | |
| 60 | // MatchesPaths implements Selector. |
| 61 | func (b *baseSelector) MatchesPaths(paths []string) bool { |
| 62 | for _, path := range paths { |
| 63 | // If include is nil, all paths are implicitly included |
| 64 | // Otherwise, check if the path matches the include pattern |
| 65 | if b.includePaths != nil && !b.includePaths.Matches(path) { |
| 66 | // Path not included, skip to next path |
| 67 | continue |
| 68 | } |
| 69 | // Path is included (either implicitly or explicitly) |
| 70 | // Now check if it should be excluded |
| 71 | if b.excludePaths != nil && b.excludePaths.Matches(path) { |
| 72 | // Path is explicitly excluded, skip to next path |
| 73 | continue |
| 74 | } |
| 75 | // If we reach here, the path is included and not excluded |
| 76 | return true |
| 77 | } |
| 78 | // None of the paths match our criteria |
| 79 | return false |
| 80 | } |
| 81 | |
| 82 | // getLoggerContext returns key/value pairs that can be used by any selector to |
| 83 | // enrich loggers with valuable context. |