执行代码:
from loguru import logger
for i in range(1000):
print(i)
logger.info(i)
执行效果:
0
1
2
3
4
2024-05-25 09:52:01.974 | INFO | __main__:<module>:6 - 0
2024-05-25 09:52:01.974 | INFO | __main__:<module>:6 - 1
2024-05-25 09:52:01.975 | INFO | __main__:<module>:6 - 2
2024-05-25 09:52:01.975 | INFO | __main__:<module>:6 - 3
2024-05-25 09:52:01.976 | INFO | __main__:<module>:6 - 4
明显出现了排序错误问题,需要设置Run/Debug Configurations的参数
设置完成后,执行效果为:
0
2024-05-25 09:52:01.974 | INFO | __main__:<module>:6 - 0
1
2024-05-25 09:52:01.974 | INFO | __main__:<module>:6 - 1
2
2024-05-25 09:52:01.975 | INFO | __main__:<module>:6 - 2
3
2024-05-25 09:52:01.975 | INFO | __main__:<module>:6 - 3
4
2024-05-25 09:52:01.976 | INFO | __main__:<module>:6 - 4
5
2024-05-25 09:52:01.977 | INFO | __main__:<module>:6 - 5
6
2024-05-25 09:52:01.977 | INFO | __main__:<module>:6 - 6