diff --git a/src/cmd/tusd/data.go b/src/cmd/tusd/data.go index b22101d..9114b65 100644 --- a/src/cmd/tusd/data.go +++ b/src/cmd/tusd/data.go @@ -4,6 +4,7 @@ package main import ( "errors" + "fmt" "io" "os" "path" @@ -67,5 +68,17 @@ func putFileChunk(fileId string, start int64, end int64, r io.Reader) error { return errors.New("putFileChunk: partial copy") } + l := logPath(fileId) + logFile, err := os.OpenFile(l, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0666) + if err != nil { + return err + } + defer logFile.Close() + + entry := fmt.Sprintf("%d,%d\n", start, end) + if _, err := logFile.WriteString(entry); err != nil { + return err + } + return nil }