Cysharp / ZLogger

Zero Allocation Text/Structured Logger for .NET with StringInterpolation and Source Generator, built on top of a Microsoft.Extensions.Logging.
MIT License
1.25k stars 88 forks source link

Enum Formatting #164

Closed kagerouttepaso closed 3 months ago

kagerouttepaso commented 3 months ago

After updating Zlogger to version 2.x.x, Enum values are being formatted as their raw values. Is there a way to log the defined string values?

var value = SampleEnum.BBB;

// Zlogger 2.x.x
logger.ZLogInformation($"enumValue : {value}"); // enumValue: 1

// Zlogger 1.x.x
logger.ZLogInformation("enumValue : {0}", value); // enumValue: BBB

public enum SampleEnum
{
    AAA,
    BBB,
    CCC,
}
neuecc commented 3 months ago

Thank you. This is unintended behavior and I will fix it immediately!

kagerouttepaso commented 3 months ago

Thanks a lot for the quick response and for being willing to fix the issue! I'm really looking forward to the updated version with the fix.

neuecc commented 3 months ago

v2.5.0 fixed this, thanks.