remove log prints or enable log level setting
sasakiyori opened this issue · comments
Every time one instance update a policy, it will print:
Get revision: 1
Set revision: 2
I actually don't need these prints, and these prints come from log.Println()
, it is hard for me to change from outside.
Can these logs be removed? I think such logs are meaningless in a base package: If I want to know if the Update
function work normally, I can use debug tools. If I want to know the revision of etcd key, I can straightly get it by etcdctl
or some how.
Or enable a log level setting, like casbin/log.Logger do. This also help for me.
Code From:
func (w *Watcher) Update() error {
rev := 0
resp, err := w.client.Get(context.Background(), w.keyName)
if err != nil {
if err != rpctypes.ErrKeyNotFound {
return err
}
} else {
if resp.Count != 0 {
rev, err = strconv.Atoi(string(resp.Kvs[0].Value))
if err != nil {
return err
}
log.Println("Get revision: ", rev)
rev += 1
}
}
newRev := strconv.Itoa(rev)
log.Println("Set revision: ", newRev)
_, err = w.client.Put(context.TODO(), w.keyName, newRev)
return err
}
@sasakiyori can you make a PR to fix it?
@hsluoyz sure, I'd like to work on this. BTW I prefer to remove these log prints straightly for the reasons mentioned above.