diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-03-30 13:03:43 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-03-30 13:03:43 -0700 |
| commit | c22094d340b5fe21ec37f7119b434664d4a52120 (patch) | |
| tree | 6aa134f787ba204190905856f4497374e72b5eee | |
| parent | 50a5018b7fb259cee84471ce8d7bb6e554602c61 (diff) | |
| download | seaweedfs-c22094d340b5fe21ec37f7119b434664d4a52120.tar.xz seaweedfs-c22094d340b5fe21ec37f7119b434664d4a52120.zip | |
adjust logging
| -rw-r--r-- | weed/filer2/filer_notify.go | 21 | ||||
| -rw-r--r-- | weed/filer2/filer_notify_append.go | 2 |
2 files changed, 13 insertions, 10 deletions
diff --git a/weed/filer2/filer_notify.go b/weed/filer2/filer_notify.go index b6274ce3d..54c3d0c48 100644 --- a/weed/filer2/filer_notify.go +++ b/weed/filer2/filer_notify.go @@ -15,18 +15,18 @@ import ( ) func (f *Filer) NotifyUpdateEvent(oldEntry, newEntry *Entry, deleteChunks bool) { - var key string + var fullpath string if oldEntry != nil { - key = string(oldEntry.FullPath) + fullpath = string(oldEntry.FullPath) } else if newEntry != nil { - key = string(newEntry.FullPath) + fullpath = string(newEntry.FullPath) } else { return } - println("key:", key) + // println("fullpath:", fullpath) - if strings.HasPrefix(key, "/.meta") { + if strings.HasPrefix(fullpath, "/.meta") { return } @@ -42,15 +42,18 @@ func (f *Filer) NotifyUpdateEvent(oldEntry, newEntry *Entry, deleteChunks bool) } if notification.Queue != nil { - glog.V(3).Infof("notifying entry update %v", key) - notification.Queue.SendMessage(key, eventNotification) + glog.V(3).Infof("notifying entry update %v", fullpath) + notification.Queue.SendMessage(fullpath, eventNotification) } - f.logMetaEvent(time.Now(), key, eventNotification) + f.logMetaEvent(time.Now(), fullpath, eventNotification) } -func (f *Filer) logMetaEvent(ts time.Time, dir string, eventNotification *filer_pb.EventNotification) { +func (f *Filer) logMetaEvent(ts time.Time, fullpath string, eventNotification *filer_pb.EventNotification) { + + dir, _ := util.FullPath(fullpath).DirAndName() + event := &filer_pb.FullEventNotification{ Directory: dir, EventNotification: eventNotification, diff --git a/weed/filer2/filer_notify_append.go b/weed/filer2/filer_notify_append.go index 4af99e022..4c134ae66 100644 --- a/weed/filer2/filer_notify_append.go +++ b/weed/filer2/filer_notify_append.go @@ -31,7 +31,7 @@ func (f *Filer) appendToFile(targetFile string, data []byte) error { if err != nil { return fmt.Errorf("upload data %s: %v", targetUrl, err) } - println("uploaded to", targetUrl) + // println("uploaded to", targetUrl) // find out existing entry fullpath := util.FullPath(targetFile) |
