diff --git a/log/enum.go b/log/enum.go index 0fd9160..f53c826 100644 --- a/log/enum.go +++ b/log/enum.go @@ -22,6 +22,7 @@ func (e ProviderName) IsValid() bool { return false } +// String will transform a providerName into a string. func (e ProviderName) String() string { return string(e) } diff --git a/log/log.go b/log/log.go index c332c10..7e6def6 100644 --- a/log/log.go +++ b/log/log.go @@ -103,6 +103,7 @@ func InitFromCustomConfig(c *ConfigStruct) (*logrus.Entry, error) { return c.applyExtraFields(logrus.NewEntry(log)), nil } +// applyExtraFileds will take a logrus.Entry and will add fields that are in the configuration. func (c *ConfigStruct) applyExtraFields(l *logrus.Entry) *logrus.Entry { return l.WithFields(c.ExtrasFields) } diff --git a/webserver/webserver.go b/webserver/webserver.go index c689ad6..1c3fd25 100644 --- a/webserver/webserver.go +++ b/webserver/webserver.go @@ -18,11 +18,14 @@ const defaultShutdownTimeout = 10 * time.Second type cleanupFunc func() error +// ExecuteServerParams are the parameters expected in the ExecuteServer function. type ExecuteServerParams struct { Cleanup cleanupFunc ShutdownTimeout *time.Duration } +// ExecuteServer will launche a http.Server and handle the "exit" signals and gracefully stop the server +// and call the cleanup function. func ExecuteServer(ctx context.Context, srv *http.Server, params *ExecuteServerParams) error { log := commonctx.GetLogger(ctx)