mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 21:17:58 +08:00
feat(sync): enable regclient logs (#3363)
feat: enable regclient logs Signed-off-by: Łukasz Jakimczuk <ljakimczuk@gmail.com>
This commit is contained in:
@@ -144,9 +144,9 @@ func (service *BaseService) init() error {
|
||||
service.clientLock.Lock()
|
||||
defer service.clientLock.Unlock()
|
||||
|
||||
client, hosts, err := newClient(service.config, service.credentials)
|
||||
client, hosts, err := newClient(service.config, service.credentials, service.log)
|
||||
if err != nil {
|
||||
service.log.Err(err).Msg("failed to parse sync config urls")
|
||||
service.log.Err(err).Msg("failed to create registry client")
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -783,7 +783,7 @@ func getTLSConfigOption(url *url.URL, tlsVerify *bool) config.TLSConf {
|
||||
return tls
|
||||
}
|
||||
|
||||
func newClient(opts syncconf.RegistryConfig, credentials syncconf.CredentialsFile,
|
||||
func newClient(opts syncconf.RegistryConfig, credentials syncconf.CredentialsFile, logger log.Logger,
|
||||
) (*regclient.RegClient, []config.Host, error) {
|
||||
urls, err := parseRegistryURLs(opts.URLs)
|
||||
if err != nil {
|
||||
@@ -875,6 +875,7 @@ func newClient(opts syncconf.RegistryConfig, credentials syncconf.CredentialsFil
|
||||
regclient.WithDockerCreds(),
|
||||
regclient.WithRegOpts(regOpts...),
|
||||
regclient.WithConfigHost(hostConfigOpts...),
|
||||
regclient.WithSlog(logger.Logger),
|
||||
)
|
||||
|
||||
return client, hostConfigOpts, nil
|
||||
|
||||
@@ -308,6 +308,7 @@ func NewLoggerWithWriter(level string, writer io.Writer) Logger {
|
||||
// GoroutineID adds goroutine-id to logs to help debug concurrency issues.
|
||||
func GoroutineID() int {
|
||||
var buf [64]byte
|
||||
|
||||
n := runtime.Stack(buf[:], false)
|
||||
idField := strings.Fields(strings.TrimPrefix(string(buf[:n]), "goroutine "))[0]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user