Skip to content

Commit

Permalink
Apply BE logic for oidc server logs (#155)
Browse files Browse the repository at this point in the history
### Description

Apply BE logic for oidc server logs.

### Type of change

* [ ] New feature
* [ ] Feature improvement
* [x] Bug fix
* [ ] Documentation
* [ ] Cleanup / refactoring
* [ ] Other (please explain)


### How is this change tested ?

* [ ] Unit tests
* [x] Manual tests (explain)
* [ ] Tests are not needed
  • Loading branch information
rthellend authored Nov 7, 2024
1 parent 6a93ef3 commit 3fd3298
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions proxy/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ func (be *Backend) logErrorF(format string, args ...any) {
log.Printf(format, args...)
}

func (be *Backend) logError(args ...any) {
if !shouldLog(logError, be.LogFilter, be.defaultLogFilter) {
return
}
log.Print(args...)
}

func shouldLog(typ logType, f ...LogFilter) bool {
if typ == logConnection {
for _, ff := range f {
Expand Down Expand Up @@ -110,6 +117,10 @@ func (p *Proxy) extLogger() logger {
return logger{p.logErrorF, p.logError}
}

func (be *Backend) extLogger() logger {
return logger{be.logErrorF, be.logError}
}

type logger struct {
f1 func(string, ...any)
f2 func(...any)
Expand Down
2 changes: 1 addition & 1 deletion proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ func (p *Proxy) Reconfigure(cfg *Config) error {
ClaimsFromCtx: claimsFromCtx,
Clients: make([]oidc.Client, 0, len(ls.Clients)),
EventRecorder: er,
Logger: p.extLogger(),
Logger: be.extLogger(),
}
for _, client := range ls.Clients {
opts.Clients = append(opts.Clients, oidc.Client{
Expand Down

0 comments on commit 3fd3298

Please sign in to comment.