I'm using the loguru package for logging in my python project.
https://github.com/Delgan/loguru
I'm looking to override the default format so I can specify a fixed with for the module / function / line number string.
Here's the default format ...
'<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | <level>{level: <8}</level> | <cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> - <level>{message}</level>'
The output is something like this ...
2020-12-28 14:36:27.510 | INFO | package1.module1:function:132 - Listing Users...
2020-12-28 14:36:27.601 | ERROR | package10.module10:function10:1000 - The provided token has expired
I want to add a static width/padding to the package/module/function so the output looks like ...
2020-12-28 14:36:27.510 | INFO | package1.module1:function:132 - Listing Users...
2020-12-28 14:36:27.601 | ERROR | package10.module10:function10:1000 - The provided token has expired
The problem is the full path with function line number is constructed from 3 variables ...
<cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan>
Is there any way I can specify a width for the combination of the strings? Something like ...
<cyan>{name + ":" + function + ":" + line : 45}</cyan>
Appreciate the help!