From 8f9e84bca0f31007ae8b4a193b9d492ec27e6f8f Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Fri, 24 Aug 2012 01:14:44 -0700 Subject: [PATCH] clean log --- weed-fs/src/cmd/weed/weed.go | 4 ---- weed-fs/src/pkg/directory/file_id.go | 3 +-- weed-fs/src/pkg/storage/compress.go | 7 +++---- weed-fs/src/pkg/storage/needle.go | 7 +++---- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/weed-fs/src/cmd/weed/weed.go b/weed-fs/src/cmd/weed/weed.go index a6f857023..52361dc60 100644 --- a/weed-fs/src/cmd/weed/weed.go +++ b/weed-fs/src/cmd/weed/weed.go @@ -5,7 +5,6 @@ import ( "flag" "fmt" "io" - "log" "net/http" "os" "strings" @@ -42,7 +41,6 @@ func setExitStatus(n int) { func main() { flag.Usage = usage flag.Parse() - log.SetFlags(0) args := flag.Args() if len(args) < 1 { @@ -172,8 +170,6 @@ func exit() { os.Exit(exitStatus) } -var logf = log.Printf - func exitIfErrors() { if exitStatus != 0 { exit() diff --git a/weed-fs/src/pkg/directory/file_id.go b/weed-fs/src/pkg/directory/file_id.go index 62fc354bf..9ce556580 100644 --- a/weed-fs/src/pkg/directory/file_id.go +++ b/weed-fs/src/pkg/directory/file_id.go @@ -2,7 +2,6 @@ package directory import ( "encoding/hex" - "log" "pkg/storage" "strings" "pkg/util" @@ -20,7 +19,7 @@ func NewFileId(VolumeId storage.VolumeId, Key uint64, Hashcode uint32) *FileId { func ParseFileId(fid string) *FileId{ a := strings.Split(fid, ",") if len(a) != 2 { - log.Println("Invalid fid", fid, ", split length", len(a)) + println("Invalid fid", fid, ", split length", len(a)) return nil } vid_string, key_hash_string := a[0], a[1] diff --git a/weed-fs/src/pkg/storage/compress.go b/weed-fs/src/pkg/storage/compress.go index 74088a3c4..d441db009 100644 --- a/weed-fs/src/pkg/storage/compress.go +++ b/weed-fs/src/pkg/storage/compress.go @@ -5,7 +5,6 @@ import ( "compress/flate" "compress/gzip" "io/ioutil" - "log" "strings" ) @@ -28,10 +27,10 @@ func GzipData(input []byte) []byte { buf := new(bytes.Buffer) w, _ := gzip.NewWriterLevel(buf, flate.BestCompression) if _, err := w.Write(input); err!=nil { - log.Printf("error compressing data:%s\n", err) + println("error compressing data:", err) } if err := w.Close(); err!=nil { - log.Printf("error closing compressed data:%s\n", err) + println("error closing compressed data:", err) } return buf.Bytes() } @@ -41,7 +40,7 @@ func UnGzipData(input []byte) []byte { defer r.Close() output, err := ioutil.ReadAll(r) if err!=nil { - log.Printf("error uncompressing data:%s\n", err) + println("error uncompressing data:", err) } return output } diff --git a/weed-fs/src/pkg/storage/needle.go b/weed-fs/src/pkg/storage/needle.go index ea3cbfb1d..8d3058a1a 100644 --- a/weed-fs/src/pkg/storage/needle.go +++ b/weed-fs/src/pkg/storage/needle.go @@ -4,7 +4,6 @@ import ( "encoding/hex" "io" "io/ioutil" - "log" "mime" "net/http" "os" @@ -27,7 +26,7 @@ func NewNeedle(r *http.Request) (n *Needle, e error) { n = new(Needle) form, fe := r.MultipartReader() if fe != nil { - log.Printf("MultipartReader [ERROR] %s\n", fe) + println("MultipartReader [ERROR]", fe) e = fe return } @@ -60,7 +59,7 @@ func (n *Needle) ParsePath(fid string) { length := len(fid) if length <= 8 { if length > 0 { - log.Println("Invalid fid", fid, "length", length) + println("Invalid fid", fid, "length", length) } return } @@ -118,7 +117,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 { - log.Println("Invalid key_hash", key_hash_string, "length:", key_hash_len, "error", khe) + 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])