私がやろうとしているのは、基本ImportError
例外を拡張することです。そのため、呼び出されるたびに、他のことも行います
import logging
logging.basicConfig(filename="logs", level=logging.DEBUG)
class ImportError(Exception):
def __init__(self, message):
Exception.__init__(self)
self.message = message
logging.warning(self.message)
import module
しかし、これは機能しません。どうすればこのようなことを達成できるか教えてください..
ありがとう。