MengRao/fmtlog

Can the log method only log the format error instead of throw the exception?

lsxia opened this issue · 2 comments

lsxia commented

It is not that uncommon for developers to miss a "{}" in for format string, which caused format_error exception at runtime. The malformed line logging code may crash the entire application, which is not desirable. Should we only log the format_error and the line number that has the format error without crashing the application?

I believe missing a {} would not throw an exception, it just leave the additonal parameters not handled, not a big issue right?

No, I believe the missing {} will cause runtime failure at this moment (which already happened a few times in our system). I agree with you that it would be better than crash if just ignoring the additional parameters.