I am designing a class whose object is instaniated with a user idn which creates a pdf with that user specific details. It should log something depending on success or failure which can be determined only by caller as the success or failure depends on if it was not just created but dispatched which is done by the caller.However two problems I can see in this design pattern is that:It does look a bit odd that caller has to log it from outside. What if the init itself fails?The way I am thinking of logging as a method if this class is probably wrong? But it doesn't seem so since it shares the state, i.e the user. Any recommendations on this design?Library Codeclass create_pdf():        Class        def __init__(self, user):                        user        db_calls_to_get_full_user_details(user)    def fetch_pdf_dms(self):                Fetch from DMS                logic    def fetch_pdf_engine(self):                Fetch from a PDF Generator                # logic that fetches the blob    def log(self, error = None):                        # If there was no failure and it was a fetch_pdf_engine        # event then I store the blob into dms for the first time.        # If the event failed I capture the exception. Finally I         #  log the event in the database.    def fetch_pdf(self):        pdf = fetch_pdf_dms        if pdf:            return pdf        return fetch_pdf_engine # which also stores to dms first time!Consumer Code:method = REQUEST['method']for each user in users:    try:        object = create_pdf(user)        object.do_something()        dispatch(method)        object.log()    except:        object.log(error=exception)
Is it good design to log something related to an object from the callee?
object oriented;python
Your pdf creating class should not log, in fact, it should not have any knowledge about your log. It should create that pdf and report any issues to its creator/caller. The creator/caller should then decide what to do with it (write to the console, write to a log file, try again, ignore, whatever). Your pdf creator is a problem domain class and it should have a single responsibility with a minimum of dependencies.