Skip to content

Commit

Permalink
Prettyfing the log output on boot for empty white-list behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
Dynom committed Oct 16, 2017
1 parent 3f56e8e commit c8f9ebb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
16 changes: 12 additions & 4 deletions argumentlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,19 @@ import "strings"

type argumentList []string

func (l argumentList) String() string {
return strings.Join(l, ",")
func (al argumentList) String() string {
return strings.Join(al, ",")
}

func (a *argumentList) Set(value string) error {
*a = append(*a, strings.Split(value, ",")...)
func (al argumentList) PrettyString() string {
if len(al) == 0 {
return "*"
}

return strings.Join(al, ",")
}

func (al *argumentList) Set(value string) error {
*al = append(*al, strings.Split(value, ",")...)
return nil
}
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ func main() {
logger.Log(
"msg", "Starting.",
"version", Version,
"allowed_hosts", allowedHosts.String(),
"allowed_params", allowedImaginaryParams.String(),
"allowed_actions", allowedImaginaryActions.String(),
"allowed_hosts", allowedHosts.PrettyString(),
"allowed_params", allowedImaginaryParams.PrettyString(),
"allowed_actions", allowedImaginaryActions.PrettyString(),
"path_to_strip", pathSegmentToStrip,
"imaginary_backend", imaginaryURL,
)
Expand Down

0 comments on commit c8f9ebb

Please sign in to comment.