Commit 66c69663 authored by Geoff Simmons's avatar Geoff Simmons

Improve logging -- *what* was successfully synced.

parent 3ca48ed6
...@@ -80,6 +80,19 @@ const ( ...@@ -80,6 +80,19 @@ const (
Delete Delete
) )
func (t SyncType) String() string {
switch t {
case Add:
return "add"
case Update:
return "update"
case Delete:
return "delete"
default:
return "unknown sync type"
}
}
// SyncObj wraps the object for which event handlers are notified, and // SyncObj wraps the object for which event handlers are notified, and
// encodes the sync event. These are the objects passed into the // encodes the sync event. These are the objects passed into the
// queues for workers. // queues for workers.
......
...@@ -238,10 +238,15 @@ func (worker *NamespaceWorker) next() { ...@@ -238,10 +238,15 @@ func (worker *NamespaceWorker) next() {
defer worker.queue.Done(obj) defer worker.queue.Done(obj)
if err := worker.dispatch(obj); err == nil { if err := worker.dispatch(obj); err == nil {
if ns, name, err := getNameSpace(obj); err == nil { syncObj, ok := obj.(*SyncObj)
worker.syncSuccess(obj, "Successfully synced: %s/%s", if ok {
ns, name) if ns, name, err := getNameSpace(syncObj.Obj); err == nil {
} else { worker.syncSuccess(obj,
"Successfully synced: %s %s/%s",
syncObj.Type, ns, name)
}
}
if !ok || err != nil {
worker.syncSuccess(obj, "Successfully synced") worker.syncSuccess(obj, "Successfully synced")
} }
worker.queue.Forget(obj) worker.queue.Forget(obj)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment