(entry *log.Entry, auth *Auth, provider string, model string)
| 5670 | } |
| 5671 | |
| 5672 | func debugLogAuthSelection(entry *log.Entry, auth *Auth, provider string, model string) { |
| 5673 | if !log.IsLevelEnabled(log.DebugLevel) { |
| 5674 | return |
| 5675 | } |
| 5676 | if entry == nil || auth == nil { |
| 5677 | return |
| 5678 | } |
| 5679 | accountType, accountInfo := auth.AccountInfo() |
| 5680 | proxyInfo := auth.ProxyInfo() |
| 5681 | suffix := "" |
| 5682 | if proxyInfo != "" { |
| 5683 | suffix = " " + proxyInfo |
| 5684 | } |
| 5685 | switch accountType { |
| 5686 | case "api_key": |
| 5687 | entry.Debugf("Use API key %s for model %s%s", util.HideAPIKey(accountInfo), model, suffix) |
| 5688 | case "oauth": |
| 5689 | ident := formatOauthIdentity(auth, provider, accountInfo) |
| 5690 | entry.Debugf("Use OAuth %s for model %s%s", ident, model, suffix) |
| 5691 | } |
| 5692 | } |
| 5693 | |
| 5694 | func formatOauthIdentity(auth *Auth, provider string, accountInfo string) string { |
| 5695 | if auth == nil { |
no test coverage detected