Closed main1015 closed 2 months ago
This is because color
has been deemed quite pointless within RecordLevel
, since it cannot be formatted. Colors should be specified using markup tags like <blue>...</blue>
and <level>...</level>
. This allows for defining a scheme using various colors, not just the one of current level, which encompasses the common format of your logs. The record
fields can be formatted with {level.name}
and {level.icon}
, but this would not map very naturally if applied to colors.
What exactly is your use case for accessing level color from a record
?
This is my code:
Below is the output:
However, I deleted the own output of loguru and defined the output format by myself, so there is no way to set the output color:
Can you use the special "<level>...</level>"
color markup in your custom format?
@Delgan
Thank you very much, I want this effect, I haven't read the document carefully before, sorry
No problem, I'm closing this ticket then, since it's resolved. :+1:
There are
color
properties when defining whatLevel
is, butRecordLevel
lacks thecolor
property when you format the output logs. In the documentation There is nocolor
in the “level: The severity used to log the message name (default)”, no, icon. But with the default log output