diff --git a/ext/tlflag/flag.go b/ext/tlflag/flag.go index b6279fe..80ff89e 100644 --- a/ext/tlflag/flag.go +++ b/ext/tlflag/flag.go @@ -113,7 +113,7 @@ more: case ".log", "": wrap = append(wrap, func(w io.Writer, c io.Closer) (io.Writer, io.Closer, error) { ff := tlog.LstdFlags - ff = updateConsoleFlags(ff, u.RawQuery) + ff = updateConsoleFlags(ff, u.Query()) w = tlog.NewConsoleWriter(w, ff) @@ -427,8 +427,10 @@ func updateFileFlags(of int, q string) int { return of } -func updateConsoleFlags(ff int, q string) int { - for _, c := range q { +func updateConsoleFlags(ff int, q url.Values) int { + flags := q.Get("console") + + for _, c := range flags { switch c { case 'd': ff |= tlog.LdetFlags diff --git a/ext/tlflag/flag_test.go b/ext/tlflag/flag_test.go index 906bd44..50c8e1b 100644 --- a/ext/tlflag/flag_test.go +++ b/ext/tlflag/flag_test.go @@ -29,7 +29,7 @@ func TestFileWriter(t *testing.T) { tlog.NewConsoleWriter(tlog.Stderr, tlog.LstdFlags), }, w) - w, err = OpenWriter("stderr?dm,stderr?dm") + w, err = OpenWriter("stderr?console=dm,stderr?console=dm") assert.NoError(t, err) assert.Equal(t, tlio.MultiWriter{ tlog.NewConsoleWriter(tlog.Stderr, tlog.LdetFlags|tlog.Lmilliseconds),