mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-15 12:31:37 +08:00
clean up log fmt usage. Move to log for important data changes,
warnings.
This commit is contained in:
@@ -4,7 +4,7 @@ import (
|
||||
"code.google.com/p/weed-fs/go/util"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"io/ioutil"
|
||||
"mime"
|
||||
"net/http"
|
||||
@@ -43,13 +43,13 @@ func NewNeedle(r *http.Request) (n *Needle, e error) {
|
||||
n = new(Needle)
|
||||
form, fe := r.MultipartReader()
|
||||
if fe != nil {
|
||||
fmt.Println("MultipartReader [ERROR]", fe)
|
||||
log.Println("MultipartReader [ERROR]", fe)
|
||||
e = fe
|
||||
return
|
||||
}
|
||||
part, fe := form.NextPart()
|
||||
if fe != nil {
|
||||
fmt.Println("Reading Multi part [ERROR]", fe)
|
||||
log.Println("Reading Multi part [ERROR]", fe)
|
||||
e = fe
|
||||
return
|
||||
}
|
||||
@@ -114,7 +114,7 @@ func (n *Needle) ParsePath(fid string) {
|
||||
length := len(fid)
|
||||
if length <= 8 {
|
||||
if length > 0 {
|
||||
println("Invalid fid", fid, "length", length)
|
||||
log.Println("Invalid fid", fid, "length", length)
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -136,7 +136,7 @@ func ParseKeyHash(key_hash_string string) (uint64, uint32) {
|
||||
key_hash_bytes, khe := hex.DecodeString(key_hash_string)
|
||||
key_hash_len := len(key_hash_bytes)
|
||||
if khe != nil || key_hash_len <= 4 {
|
||||
println("Invalid key_hash", key_hash_string, "length:", key_hash_len, "error", khe)
|
||||
log.Println("Invalid key_hash", key_hash_string, "length:", key_hash_len, "error", khe)
|
||||
return 0, 0
|
||||
}
|
||||
key := util.BytesToUint64(key_hash_bytes[0 : key_hash_len-4])
|
||||
|
@@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
@@ -26,7 +27,7 @@ func (n *Needle) Append(w io.Writer, version Version) (size uint32, err error) {
|
||||
defer func(s io.Seeker, off int64) {
|
||||
if err != nil {
|
||||
if _, e = s.Seek(off, 0); e != nil {
|
||||
fmt.Printf("Failed to seek %s back to %d with error: %s\n", w, off, e)
|
||||
log.Printf("Failed to seek %s back to %d with error: %s\n", w, off, e)
|
||||
}
|
||||
}
|
||||
}(s, end)
|
||||
|
@@ -108,7 +108,7 @@ func (v *Volume) Size() int64 {
|
||||
if e == nil {
|
||||
return stat.Size()
|
||||
}
|
||||
fmt.Printf("Failed to read file size %s %s\n", v.dataFile.Name(), e.Error())
|
||||
log.Printf("Failed to read file size %s %s\n", v.dataFile.Name(), e.Error())
|
||||
return -1
|
||||
}
|
||||
func (v *Volume) Close() {
|
||||
@@ -120,7 +120,7 @@ func (v *Volume) Close() {
|
||||
func (v *Volume) maybeWriteSuperBlock() error {
|
||||
stat, e := v.dataFile.Stat()
|
||||
if e != nil {
|
||||
fmt.Printf("failed to stat datafile %s: %s", v.dataFile, e)
|
||||
log.Printf("failed to stat datafile %s: %s", v.dataFile, e)
|
||||
return e
|
||||
}
|
||||
if stat.Size() == 0 {
|
||||
|
Reference in New Issue
Block a user