diff options
| author | Chris Lu <chris.lu@gmail.com> | 2013-08-08 23:57:22 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2013-08-08 23:57:22 -0700 |
| commit | ed154053c833f9bcce9094e535e2adc0a0397e46 (patch) | |
| tree | 40dc16b76a12929bc8ac7af0549ccf65316e9011 /go/sequence/sequence.go | |
| parent | b27947b3550dfdf091010bd2607b8c36a5dca049 (diff) | |
| download | seaweedfs-ed154053c833f9bcce9094e535e2adc0a0397e46.tar.xz seaweedfs-ed154053c833f9bcce9094e535e2adc0a0397e46.zip | |
switching to temporarily use glog library
Diffstat (limited to 'go/sequence/sequence.go')
| -rw-r--r-- | go/sequence/sequence.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/go/sequence/sequence.go b/go/sequence/sequence.go index 3130740f1..658996153 100644 --- a/go/sequence/sequence.go +++ b/go/sequence/sequence.go @@ -2,7 +2,7 @@ package sequence import ( "encoding/gob" - "log" + "code.google.com/p/weed-fs/go/glog" "os" "path" "sync" @@ -32,16 +32,16 @@ func NewSequencer(dirname string, filename string) (m *SequencerImpl) { seqFile, se := os.OpenFile(path.Join(m.dir, m.fileName+".seq"), os.O_RDONLY, 0644) if se != nil { m.FileIdSequence = FileIdSaveInterval - log.Println("Setting file id sequence", m.FileIdSequence) + glog.V(0).Infoln("Setting file id sequence", m.FileIdSequence) } else { decoder := gob.NewDecoder(seqFile) defer seqFile.Close() if se = decoder.Decode(&m.FileIdSequence); se != nil { - log.Printf("error decoding FileIdSequence: %s", se) + glog.V(0).Infof("error decoding FileIdSequence: %s", se) m.FileIdSequence = FileIdSaveInterval - log.Println("Setting file id sequence", m.FileIdSequence) + glog.V(0).Infoln("Setting file id sequence", m.FileIdSequence) } else { - log.Println("Loading file id sequence", m.FileIdSequence, "=>", m.FileIdSequence+FileIdSaveInterval) + glog.V(0).Infoln("Loading file id sequence", m.FileIdSequence, "=>", m.FileIdSequence+FileIdSaveInterval) m.FileIdSequence += FileIdSaveInterval } //in case the server stops between intervals @@ -65,14 +65,14 @@ func (m *SequencerImpl) NextFileId(count int) (uint64, int) { return m.FileIdSequence - m.fileIdCounter - uint64(count), count } func (m *SequencerImpl) saveSequence() { - log.Println("Saving file id sequence", m.FileIdSequence, "to", path.Join(m.dir, m.fileName+".seq")) + glog.V(0).Infoln("Saving file id sequence", m.FileIdSequence, "to", path.Join(m.dir, m.fileName+".seq")) seqFile, e := os.OpenFile(path.Join(m.dir, m.fileName+".seq"), os.O_CREATE|os.O_WRONLY, 0644) if e != nil { - log.Fatalf("Sequence File Save [ERROR] %s\n", e) + glog.Fatalf("Sequence File Save [ERROR] %s", e) } defer seqFile.Close() encoder := gob.NewEncoder(seqFile) if e = encoder.Encode(m.FileIdSequence); e != nil { - log.Fatalf("Sequence File Save [ERROR] %s\n", e) + glog.Fatalf("Sequence File Save [ERROR] %s", e) } } |
