Python logging typeerror
你能帮帮我吗,怎么了?
1 2 3 4 5 | import logging if (__name__ =="__main__"): logging.basicConfig(format='[%(asctime)s] %(levelname)s::%(module)s::%(funcName)s() %(message)s', level=logging.DEBUG) logging.INFO("test") |
我不能运行它,我有一个错误:
1 2 3 4 | Traceback (most recent call last): File"/home/htfuws/Programming/Python/just-kidding/main.py", line 5, in logging.INFO("test") TypeError: 'int' object is not callable |
非常感谢你。
INFO Confirmation that things are working as expected.
你需要的是
1 | logging.info("test") |
您试图调用
1 2 3 4 5 | >>> import logging >>> logging.INFO 20 >>> type(logging.INFO) <type 'int'> |
您可能想使用
Logs a message with level
INFO on this logger. The arguments are interpreted as fordebug() .