diff --git a/context.go b/context.go index ab456e2..7b26531 100644 --- a/context.go +++ b/context.go @@ -134,11 +134,11 @@ func (c *Context) InitContext() { } logrus.Infof("Using Let's Encrypt %s API", apiVersion) + c.Acme.EnableLogs() // Enable debug mode if c.Debug { logrus.SetLevel(logrus.DebugLevel) - c.Acme.EnableDebug() } } diff --git a/letsencrypt/client.go b/letsencrypt/client.go index 0d5750e..9cc0caf 100644 --- a/letsencrypt/client.go +++ b/letsencrypt/client.go @@ -149,9 +149,11 @@ func NewClient(email string, kt KeyType, apiVer ApiVersion, dnsResolvers []strin }, nil } -// EnableDebugLogging enables logging in the upstream lego library -func (c *Client) EnableDebug() { - lego.Logger = log.New(os.Stdout, "", 0) +// EnableLogs prints logs from the upstream lego library +func (c *Client) EnableLogs() { + logger := logrus.New() + logger.Out = os.Stdout + lego.Logger = log.New(logger.Writer(), "", 0) } // Issue obtains a new SAN certificate from the Lets Encrypt CA diff --git a/main.go b/main.go index 0bde234..a1d3dbf 100644 --- a/main.go +++ b/main.go @@ -19,7 +19,7 @@ var ( func init() { flag.BoolVar(&debug, "debug", false, "Enable debugging") flag.BoolVar(&testMode, "test-mode", false, "Renew certificate every 120 seconds") - logrus.SetFormatter(&logrus.TextFormatter{DisableTimestamp: true}) + // logrus.SetFormatter(&logrus.TextFormatter{DisableTimestamp: true}) logrus.SetOutput(os.Stdout) }