MCPcopy Create free account
hub / github.com/cli/cli / setLog

Function setLog

api/http_client.go:164–172  ·  view source on GitHub ↗

setLog configures the HTTP logger. A verbose log includes response headers and bodies as the server sent them, so its output is sanitized. It isn't colorized, since sanitizing would also neutralize the colors.

(clientOpts *ghAPI.ClientOptions, log io.Writer, colorize, verbose bool)

Source from the content-addressed store, hash-verified

162// setLog configures the HTTP logger. A verbose log includes response headers and bodies as the server sent them, so
163// its output is sanitized. It isn't colorized, since sanitizing would also neutralize the colors.
164func setLog(clientOpts *ghAPI.ClientOptions, log io.Writer, colorize, verbose bool) {
165 if verbose && log != nil {
166 log = sanitizingWriter{w: log}
167 colorize = false
168 }
169 clientOpts.Log = log
170 clientOpts.LogColorize = colorize
171 clientOpts.LogVerboseHTTP = verbose
172}
173
174// sanitizingWriter neutralizes terminal escape sequences and other control characters written through it.
175type sanitizingWriter struct {

Callers 2

NewHTTPClientFunction · 0.85
NewExternalHTTPClientFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected