From the latest version it looks like _log is the appropriate attribute to be using to get at the logger.
I don't think it's an issue with the actual code example you've pasted itself, but perhaps somewhere else in cocotb which is using the deprecated log attribute.
I was seeing this myself, actually, and used a crude method to pinpoint where the calls were coming from by using the traceback module and modifying the __getattr__ and __setattr__ functions in the SimHandleBase class in cocotb/handle.py like so:
import traceback
class SimHandleBase(object):
...
def __setattr__(self, name, value):
if name in self._compat_mapping:
if name not in _deprecation_warned:
warnings.warn("Use of %s attribute is deprecated" % name)
for line in traceback.format_stack(): # Inserted to print stack trace
print(line.strip()) # Inserted to print stack trace
_deprecation_warned[name] = True
return setattr(self, self._compat_mapping[name], value)
else:
return object.__setattr__(self, name, value)
def __getattr__(self, name):
if name in self._compat_mapping:
if name not in _deprecation_warned:
warnings.warn("Use of %s attribute is deprecated" % name)
for line in traceback.format_stack(): # Inserted to print stack trace
print(line.strip()) # Inserted to print stack trace
_deprecation_warned[name] = True
return getattr(self, self._compat_mapping[name])
else:
return object.__getattr__(self, name)