denshoproject / ddr-cmdln

Command-line tools for automating the Densho Digital Repository's various processes.
Other
0 stars 2 forks source link

Replace `DDR.ingest.AddFileLogger` with Python `logging` #221

Closed gjost closed 1 year ago

gjost commented 1 year ago

AddFileLogger is a separate, homegrown piece of code that does the same thing as logging. The difference is that it writes to a separate file for each Entity i.e. /var/log/ddr/addfile/COLLECTIONID/ENTITYID.log. I remember hearing about the ok/not_ok/crash scheme in a podcast, but I don't remember why I decided to make this except that maybe I couldn't figure out how to get Python's logging to write to a different file for this operation.

Since we're doing some refactoring of ddrimport I thought I'd just drop in logging in place of AddFileLogger but it's not as simple as that. It's own project.

gjost commented 1 year ago

This turned out not to be the best idea. DDR.ingest.AddFileLogger was created to enable writing separate logs for the file import process. I could not figure out how to get the Python logging module to write certain entries to a separate and temporary file. We'll stick with this for now.

Update: I ended up moving DDR.ingest.AddFileLogger to DDR.util.FileLogger because it will also be used by ddrlocal's web-UI file imports.