(realTime bool)
| 794 | } |
| 795 | |
| 796 | func (h *handler) logDuration(realTime bool) { |
| 797 | if h.loggedDuration { |
| 798 | return |
| 799 | } |
| 800 | h.loggedDuration = true |
| 801 | |
| 802 | var duration time.Duration |
| 803 | if realTime { |
| 804 | duration = time.Since(h.startTime) |
| 805 | } |
| 806 | |
| 807 | // Log timings/status codes for errors under the HTTP log key |
| 808 | // and the HTTPResp log key for everything else. |
| 809 | logKey := base.KeyHTTPResp |
| 810 | logLevel := base.LevelInfo |
| 811 | |
| 812 | // if error status, log at HTTP/Info |
| 813 | if h.status >= 300 { |
| 814 | logKey = base.KeyHTTP |
| 815 | } else if h.httpLogLevel != nil { |
| 816 | // if the handler requested a different log level, and the request was successful, we'll honour that log level. |
| 817 | logLevel = *h.httpLogLevel |
| 818 | } |
| 819 | |
| 820 | base.LogLevelCtx(h.ctx(), logLevel, logKey, "%s: --> %d %s (%.1f ms)", |
| 821 | h.formatSerialNumber(), h.status, h.statusMessage, |
| 822 | float64(duration)/float64(time.Millisecond), |
| 823 | ) |
| 824 | } |
| 825 | |
| 826 | // logRESTCount will increment the number of public REST requests stat for public REST requests excluding _blipsync requests if they are attached to a database. |
| 827 | func (h *handler) logRESTCount() { |
no test coverage detected