How to console print everytime something is added to a list

I’m writing some automation in the editor and would like to have it automatically Debug.Log the items that are getting added to a list. I could go line by line and do this prior to my array but that would be tedious as it’s thousands of lines. Here is what I have thought up:

List<string> _convertLog = new List<string>();

List<string> convertLog
        {
            get
            {
                return _convertLog;
            }
            set
            {
                _convertLog = value;
                Debug.Log(value);
            }
        }

However its also getting used like this:

CB_COMP_vThirdPersonController(_copiedPlayer, ref convertLog);

That’s throwing errors on me:

A property or indexer may not be passed as an out or ref parameter

What’s the best way to do this?

One way (not necessarily the best) to do this is to make your own list by deriving from normal list and make a new Add method.

           class _List<T> : List<T>
            {
                public new void Add(T item)
                {
                    base.Add(item);
                    Debug.Log(item.ToString());
                }
            }

Then you can define your list

        _List<string> mylist = new _List<string>();

When you use mylist.Add(“your string”) it will also debug.log it to the console