diff --git a/README.md b/README.md index 12df851..6c85856 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ Extends [cli](https://github.com/fortio/cli#cli) to server `main()`s . In addition to flags, usage and help output, arguments validation, `scli` abstracts the repetitive parts of a `main()` to setup a config directory watch for [dynamic flags](https://github.com/fortio/dflag) (configmap in kubernetes cases) and configuration endpoint/UI/api. +It also sets up standard library logger interception to log these under same JSON (or color console) format. + You can see real use example in a server like [proxy](https://github.com/fortio/proxy). ## Server Example diff --git a/go.mod b/go.mod index f54ff61..c7d73bc 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( fortio.org/cli v1.3.3 fortio.org/dflag v1.5.3 - fortio.org/log v1.9.3 + fortio.org/log v1.10.0 fortio.org/version v1.0.2 golang.org/x/sys v0.10.0 ) diff --git a/go.sum b/go.sum index c22e8fa..91037d8 100644 --- a/go.sum +++ b/go.sum @@ -3,8 +3,8 @@ fortio.org/cli v1.3.3 h1:b2JPQ7ekVFpF7SrEllJTbh1rdivsyXT081oQUeiuIp0= fortio.org/cli v1.3.3/go.mod h1:ZsevXTvMidh3xllYoAElS52XRcGx+f1hVlgB+v2Pa0Y= fortio.org/dflag v1.5.3 h1:+pCqZBCz95PYTxhcmenjrkVORWIRB1Je4eO/So574Bc= fortio.org/dflag v1.5.3/go.mod h1:cM/ojIzdDv8FRA5yqSRpDK9jCGmASln0k7ag3zeiqbw= -fortio.org/log v1.9.3 h1:rkgDmgF7dLfNRtVOE44Av5KBlro8FkpTKnTnphHy074= -fortio.org/log v1.9.3/go.mod h1:u/8/2lyczXq52aT5Nw6reD+3cR6m/EbS2jBiIYhgiTU= +fortio.org/log v1.10.0 h1:Id2z9HjGlof0VsIHi2XNI9k+tG7ujODVDnAAvkSgpuE= +fortio.org/log v1.10.0/go.mod h1:u/8/2lyczXq52aT5Nw6reD+3cR6m/EbS2jBiIYhgiTU= fortio.org/sets v1.0.3 h1:HzewdGjH69YmyW06yzplL35lGr+X4OcqQt0qS6jbaO4= fortio.org/sets v1.0.3/go.mod h1:QZVj0r6KP/ZD9ebySW9SgxVNy/NjghUfyHW9NN+WU+4= fortio.org/version v1.0.2 h1:8NwxdX58aoeKx7T5xAPO0xlUu1Hpk42nRz5s6e6eKZ0= diff --git a/scli.go b/scli.go index 84b3321..43662b7 100644 --- a/scli.go +++ b/scli.go @@ -80,6 +80,10 @@ func ServerMain() bool { log.Critf("Unable to watch config/flag changes in %v: %v", *configDir, err) } } + + // So http client library for instance ends up logging in JSON or color too and not break json parsing. + log.InterceptStandardLogger(log.Warning) + shortScliV, _, _ := version.FromBuildInfoPath("fortio.org/scli") hasStartedServer := false