Write chunk log

This commit is contained in:
Felix Geisendörfer 2013-03-18 11:48:16 +01:00
parent b6a277ddd1
commit a5a78c786a
1 changed files with 13 additions and 0 deletions

View File

@ -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
}