Hello,
I'm trying to implement a logger for my plugin that saves logging messages from level DEBUG & higher. When I try using Python's logging module's basicConfig method, I'm unable to change the level or write the file. Here's the test script I'm using:
import c4d, os, logging
from c4d import storage
def main():
WRITEPATH = os.path.join(storage.GeGetC4DPath(c4d.C4D_PATH_DESKTOP), "MyLog.log")
logging.basicConfig(filename=WRITEPATH, level=logging.DEBUG, filemode='w', format='%(name)s - %(levelname)s - %(message)s')
logging.debug('This is a debug message')
logging.info('This is an info message')
logging.warning('This is a warning message')
logging.error('This is an error message')
logging.critical('This is a critical message')
if __name__=='__main__':
main()
I've tried finding more information on Cinema 4D's logging and found this document on the LoggerInterface. I couldn't, however, find an example of how this is to be used. Can someone please provide a working example of saving log messages to a file in Cinema 4D? Thank you!