Apr-02-2020, 04:43 AM
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:
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 calling
copier.report()
). Or you can make your function to return the statistics, instead of set of files affected as the original function does.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs