New logger for the Traefik logs
This commit is contained in:
parent
27c02b5a56
commit
56f7515ecd
297 changed files with 2337 additions and 1934 deletions
|
@ -9,7 +9,8 @@ import (
|
|||
|
||||
"github.com/go-acme/lego/v4/certcrypto"
|
||||
"github.com/go-acme/lego/v4/registration"
|
||||
"github.com/traefik/traefik/v2/pkg/log"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/traefik/traefik/v2/pkg/logs"
|
||||
)
|
||||
|
||||
// Account is used to store lets encrypt registration info.
|
||||
|
@ -56,8 +57,8 @@ func (a *Account) GetRegistration() *registration.Resource {
|
|||
func (a *Account) GetPrivateKey() crypto.PrivateKey {
|
||||
privateKey, err := x509.ParsePKCS1PrivateKey(a.PrivateKey)
|
||||
if err != nil {
|
||||
log.WithoutContext().WithField(log.ProviderName, "acme").
|
||||
Errorf("Cannot unmarshal private key %+v: %v", a.PrivateKey, err)
|
||||
log.Error().Str(logs.ProviderName, "acme").
|
||||
Err(err).Msgf("Cannot unmarshal private key %+v", a.PrivateKey)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -66,7 +67,7 @@ func (a *Account) GetPrivateKey() crypto.PrivateKey {
|
|||
|
||||
// GetKeyType used to determine which algo to used.
|
||||
func GetKeyType(ctx context.Context, value string) certcrypto.KeyType {
|
||||
logger := log.FromContext(ctx)
|
||||
logger := log.Ctx(ctx)
|
||||
|
||||
switch value {
|
||||
case "EC256":
|
||||
|
@ -80,10 +81,10 @@ func GetKeyType(ctx context.Context, value string) certcrypto.KeyType {
|
|||
case "RSA8192":
|
||||
return certcrypto.RSA8192
|
||||
case "":
|
||||
logger.Infof("The key type is empty. Use default key type %v.", certcrypto.RSA4096)
|
||||
logger.Info().Msgf("The key type is empty. Use default key type %v.", certcrypto.RSA4096)
|
||||
return certcrypto.RSA4096
|
||||
default:
|
||||
logger.Infof("Unable to determine the key type value %q: falling back on %v.", value, certcrypto.RSA4096)
|
||||
logger.Info().Msgf("Unable to determine the key type value %q: falling back on %v.", value, certcrypto.RSA4096)
|
||||
return certcrypto.RSA4096
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue