hydrus icon indicating copy to clipboard operation
hydrus copied to clipboard

Coverage of logging is poor

Open Mec-iS opened this issue 3 years ago • 2 comments

I'm submitting a

  • [x] feature request.

Current Behaviour:

Logging is only present in app.py. Logging is seldommly used. For example in the case of delete_collection_member:

    try:
        session.commit()
    except InvalidRequestError:
        session.rollback()
    return collection_id

Expected Behaviour:

The function above issues a rollback without logging. Rolling back operations are importanto to highlight for maintance reason, so it should look like:

    try:
        session.commit()
    except InvalidRequestError as e:
        session.rollback()
        logging.warning("Rollback in [function name] because of {str(e)}")
        [raise 400]?
    return collection_id

It would be nice to take this opportunity to implement structured logging with structlog

Mec-iS avatar Jul 26 '21 11:07 Mec-iS

I think @Purvanshsingh was working on this. But later it was removed. Do we have to add it again ?

farazkhanfk7 avatar Jul 26 '21 11:07 farazkhanfk7

Yes let's keep this with low priority. Logging is fundamental for proper maintenance.

Mec-iS avatar Jul 26 '21 11:07 Mec-iS