Store `ipdevpoll` log output from failed jobs in the database
ipdevpoll uses the stdlib Python logging framework to output log messages. It uses some homemade adapters to include job context in log output (the context of a log message in ipdevpoll is usually a combination of a job name and a netbox sysname).
There is already a "job log" table in the database, that stores metadata about (IIRC) the last 100 jobs or so from each context (metadata is mostly job context, start time, duration and success/failure status).
For failed jobs, it would be useful for the log messages of failed jobs to be attached to these logs.
It isn't immediately clear what the log consumption needs are here. This would affect whether each log message needs to be stored as a separate record, or if the full log output could be stored as just a blob of text. It also affects whether the log output is best suited to be stored in a separate table with a foreign key relation to the job log table, or as a new field on the existing job log table.
We also need somehow to change our log adapters to be able to store the log output of each context separately, most likely into memory, for each separate job. At the end of a job, this stored text would be dumped into the database if the job failed, before the in-memory store is wiped.