Skip to content

Commit

Permalink
Enable ACME library logs
Browse files Browse the repository at this point in the history
  • Loading branch information
janeczku committed May 14, 2017
1 parent a1425e4 commit 8d2f8c7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down
8 changes: 5 additions & 3 deletions letsencrypt/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 8d2f8c7

Please sign in to comment.