mirror of
https://code.rocketnine.space/tslocum/twins.git
synced 2024-11-27 12:48:13 +01:00
Print access log by default
This commit is contained in:
parent
be89b61596
commit
74fa3d5c2e
4 changed files with 7 additions and 7 deletions
2
go.mod
2
go.mod
|
@ -6,6 +6,6 @@ require (
|
|||
github.com/h2non/filetype v1.1.0
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
|
||||
github.com/yookoala/gofast v0.4.1-0.20201013050739-975113c54107
|
||||
golang.org/x/tools v0.0.0-20201116165547-1a2739ce1bfb // indirect
|
||||
golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776
|
||||
)
|
||||
|
|
4
go.sum
4
go.sum
|
@ -34,8 +34,8 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm
|
|||
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20200908211811-12e1bf57a112/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE=
|
||||
golang.org/x/tools v0.0.0-20201116165547-1a2739ce1bfb h1:QEy3Xa/NrmW1ReQDWZq9JhNZaS2eWWumNV6RAEKnQzQ=
|
||||
golang.org/x/tools v0.0.0-20201116165547-1a2739ce1bfb/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10 h1:epqY6OjPdDktZ8Cbnv7rUhy89e44hYWhxmhdecJr4cg=
|
||||
golang.org/x/tools v0.0.0-20201117021029-3c3a81204b10/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
|
4
main.go
4
main.go
|
@ -13,13 +13,13 @@ func init() {
|
|||
log.SetOutput(os.Stdout)
|
||||
}
|
||||
|
||||
var verbose bool
|
||||
var quiet bool
|
||||
|
||||
func main() {
|
||||
log.SetFlags(0)
|
||||
|
||||
configFile := flag.String("config", "", "path to configuration file")
|
||||
flag.BoolVar(&verbose, "verbose", false, "print request log")
|
||||
flag.BoolVar(&quiet, "quiet", false, "do not print access log")
|
||||
flag.Parse()
|
||||
|
||||
if *configFile == "" {
|
||||
|
|
|
@ -292,13 +292,13 @@ func handleConn(c *tls.Conn) {
|
|||
size := int64(-1)
|
||||
|
||||
defer func() {
|
||||
if !verbose && logPath == "" {
|
||||
if quiet && logPath == "" {
|
||||
return
|
||||
}
|
||||
|
||||
entry := logEntry(request, status, size, time.Since(t))
|
||||
|
||||
if verbose {
|
||||
if !quiet {
|
||||
log.Println(string(entry))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue