Whenever I call my logger in a method, e.g.
_logger.Debug("Connecting to database...");
I get the warning:
CA1303 : Microsoft.Globalization:
Method 'Database.Connect()' passes a literal
string as parameter 'message' of a call to 'ILogger.Debug(string)'.
Retrieve the following string(s) from a resource table instead:
"Connecting to database...".
Is there a way to suppress this warning every time I use a function of ILogger
?
I really don't want to suppress it in every method I'm using it.
If you control the ILogger
interface, you can leverage the Localizable
attribute with a value of false to indicate the value is not localizable.
For example:
void Info([Localizable(false)] string message);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With