Apr-02-2020, 04:48 AM
Thanks for your quick reply Buran. I will have to take my time
going through your help, just wanted to let you know
I am on it and to thank you.
going through your help, just wanted to let you know
I am on it and to thank you.
(Apr-02-2020, 04:43 AM)buran Wrote: If you want to pass custom logger, you need to create logger object using logging module and pass it when call sync.
That is the way to customize reporting provided by the dirsync author.
As an alternative you can create your own sync function.
Look at dirsync.sync source code:
def sync(sourcedir, targetdir, action, **options): copier = Syncer(sourcedir, targetdir, action, **options) copier.do_work() # print report at the end copier.report() return set(copier._changed).union(copier._added).union(copier._deleted)as you can see they instantiate dirsync.Syncer object. when the function execution completes this object is destroyed. That is why you don't have access to properties you want. You can do your own reporting (instead of callingcopier.report()
). Or you can make your function to return the statistics, instead of set of files affected as the original function does.