Display bytes written to response instead of size of files being served in logs
This commit is contained in:
parent
7d49a86e70
commit
16d1428a52
|
@ -11,7 +11,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
ReleaseVersion string = "0.90.1"
|
||||
ReleaseVersion string = "0.90.3"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
10
cmd/web.go
10
cmd/web.go
|
@ -96,9 +96,7 @@ func serveStaticFile(paths []string, cache *fileCache, errorChannel chan<- error
|
|||
return
|
||||
}
|
||||
|
||||
w.Write(buf)
|
||||
|
||||
fileSize := humanReadableSize(len(buf))
|
||||
written, _ := w.Write(buf)
|
||||
|
||||
refererUri, err := stripQueryParams(refererToUri(r.Referer()))
|
||||
if err != nil {
|
||||
|
@ -124,7 +122,7 @@ func serveStaticFile(paths []string, cache *fileCache, errorChannel chan<- error
|
|||
fmt.Printf("%s | Serve: %s (%s) to %s in %s\n",
|
||||
startTime.Format(logDate),
|
||||
filePath,
|
||||
fileSize,
|
||||
humanReadableSize(written),
|
||||
realIP(r),
|
||||
time.Since(startTime).Round(time.Microsecond),
|
||||
)
|
||||
|
@ -296,7 +294,7 @@ func serveMedia(paths []string, regexes *regexes, cache *fileCache, formats *typ
|
|||
|
||||
formattedPage := gohtml.Format(htmlBody.String())
|
||||
|
||||
_, err = io.WriteString(w, formattedPage)
|
||||
written, err := io.WriteString(w, formattedPage)
|
||||
if err != nil {
|
||||
errorChannel <- err
|
||||
|
||||
|
@ -310,7 +308,7 @@ func serveMedia(paths []string, regexes *regexes, cache *fileCache, formats *typ
|
|||
fmt.Printf("%s | Serve: %s (%s) to %s in %s\n",
|
||||
startTime.Format(logDate),
|
||||
path,
|
||||
humanReadableSize(len(formattedPage)),
|
||||
humanReadableSize(written),
|
||||
realIP(r),
|
||||
time.Since(startTime).Round(time.Microsecond),
|
||||
)
|
||||
|
|
|
@ -222,7 +222,7 @@ func (t Format) Validate(filePath string) bool {
|
|||
}
|
||||
|
||||
func (t Format) Type() string {
|
||||
return "html"
|
||||
return "inline"
|
||||
}
|
||||
|
||||
func New(theme string) Format {
|
||||
|
|
|
@ -77,7 +77,7 @@ func (t Format) Validate(filePath string) bool {
|
|||
}
|
||||
|
||||
func (t Format) Type() string {
|
||||
return "html"
|
||||
return "inline"
|
||||
}
|
||||
|
||||
func New() Format {
|
||||
|
|
Loading…
Reference in New Issue