HttpTwo
HttpTwo copied to clipboard
Logging issue: Possible FormatException
Current logging implementation is not safe:
public void Error (string format, params object[] args)
{
if (Level >= LogLevel.Error)
write (string.Format (format, args));
}
void write (string format, params object[] args)
{
Console.WriteLine (DateTime.Now.ToString ("hh:MM:ss.fff tt") + ": " + string.Format (format, args));
}
You shouldn't use double string.Format calls. It will cause exception if first string.Format constructs string with "{" in it. For instance:
Error("Some text: {0}", "Some arg with {0} placeholder ")
Also could you please disable by default logging for nuget package (at least I don't think that debug logging enabled by default is a good idea)