class StrLogger(str):

    def __init__(self, *args):
        self._log_ = []
str.__init__(self, *args)

def __getattribute__(self, attr):
    log = str.__getattribute__(self, '_log_')
cls = str.__getattribute__(self, '__class__')
name = cls.__name__
log.append((name, attr))
return str.__getattribute__(self, attr)
s = StrLogger('abc')
print(s.title())
print(s.lower())
print(s.upper())
print(s.__dict__)
Python: how to access an attribute from a __getattribute__ method