Skip to content

Logging issue: Possible FormatException #10

Description

@bahusoid

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions