mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
clean log
This commit is contained in:
parent
869a6711bc
commit
8f9e84bca0
|
@ -5,7 +5,6 @@ import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -42,7 +41,6 @@ func setExitStatus(n int) {
|
||||||
func main() {
|
func main() {
|
||||||
flag.Usage = usage
|
flag.Usage = usage
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
log.SetFlags(0)
|
|
||||||
|
|
||||||
args := flag.Args()
|
args := flag.Args()
|
||||||
if len(args) < 1 {
|
if len(args) < 1 {
|
||||||
|
@ -172,8 +170,6 @@ func exit() {
|
||||||
os.Exit(exitStatus)
|
os.Exit(exitStatus)
|
||||||
}
|
}
|
||||||
|
|
||||||
var logf = log.Printf
|
|
||||||
|
|
||||||
func exitIfErrors() {
|
func exitIfErrors() {
|
||||||
if exitStatus != 0 {
|
if exitStatus != 0 {
|
||||||
exit()
|
exit()
|
||||||
|
|
|
@ -2,7 +2,6 @@ package directory
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"log"
|
|
||||||
"pkg/storage"
|
"pkg/storage"
|
||||||
"strings"
|
"strings"
|
||||||
"pkg/util"
|
"pkg/util"
|
||||||
|
@ -20,7 +19,7 @@ func NewFileId(VolumeId storage.VolumeId, Key uint64, Hashcode uint32) *FileId {
|
||||||
func ParseFileId(fid string) *FileId{
|
func ParseFileId(fid string) *FileId{
|
||||||
a := strings.Split(fid, ",")
|
a := strings.Split(fid, ",")
|
||||||
if len(a) != 2 {
|
if len(a) != 2 {
|
||||||
log.Println("Invalid fid", fid, ", split length", len(a))
|
println("Invalid fid", fid, ", split length", len(a))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
vid_string, key_hash_string := a[0], a[1]
|
vid_string, key_hash_string := a[0], a[1]
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"compress/flate"
|
"compress/flate"
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -28,10 +27,10 @@ func GzipData(input []byte) []byte {
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
w, _ := gzip.NewWriterLevel(buf, flate.BestCompression)
|
w, _ := gzip.NewWriterLevel(buf, flate.BestCompression)
|
||||||
if _, err := w.Write(input); err!=nil {
|
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 {
|
if err := w.Close(); err!=nil {
|
||||||
log.Printf("error closing compressed data:%s\n", err)
|
println("error closing compressed data:", err)
|
||||||
}
|
}
|
||||||
return buf.Bytes()
|
return buf.Bytes()
|
||||||
}
|
}
|
||||||
|
@ -41,7 +40,7 @@ func UnGzipData(input []byte) []byte {
|
||||||
defer r.Close()
|
defer r.Close()
|
||||||
output, err := ioutil.ReadAll(r)
|
output, err := ioutil.ReadAll(r)
|
||||||
if err!=nil {
|
if err!=nil {
|
||||||
log.Printf("error uncompressing data:%s\n", err)
|
println("error uncompressing data:", err)
|
||||||
}
|
}
|
||||||
return output
|
return output
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
|
||||||
"mime"
|
"mime"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
@ -27,7 +26,7 @@ func NewNeedle(r *http.Request) (n *Needle, e error) {
|
||||||
n = new(Needle)
|
n = new(Needle)
|
||||||
form, fe := r.MultipartReader()
|
form, fe := r.MultipartReader()
|
||||||
if fe != nil {
|
if fe != nil {
|
||||||
log.Printf("MultipartReader [ERROR] %s\n", fe)
|
println("MultipartReader [ERROR]", fe)
|
||||||
e = fe
|
e = fe
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -60,7 +59,7 @@ func (n *Needle) ParsePath(fid string) {
|
||||||
length := len(fid)
|
length := len(fid)
|
||||||
if length <= 8 {
|
if length <= 8 {
|
||||||
if length > 0 {
|
if length > 0 {
|
||||||
log.Println("Invalid fid", fid, "length", length)
|
println("Invalid fid", fid, "length", length)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -118,7 +117,7 @@ func ParseKeyHash(key_hash_string string) (uint64, uint32) {
|
||||||
key_hash_bytes, khe := hex.DecodeString(key_hash_string)
|
key_hash_bytes, khe := hex.DecodeString(key_hash_string)
|
||||||
key_hash_len := len(key_hash_bytes)
|
key_hash_len := len(key_hash_bytes)
|
||||||
if khe != nil || key_hash_len <= 4 {
|
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
|
return 0, 0
|
||||||
}
|
}
|
||||||
key := util.BytesToUint64(key_hash_bytes[0 : key_hash_len-4])
|
key := util.BytesToUint64(key_hash_bytes[0 : key_hash_len-4])
|
||||||
|
|
Loading…
Reference in a new issue