Exemple #1
0
        public FileLogWriter(string argument)
            : this(null, null, DefaultLevel)
        {
            var args = argument.ReadCommandLineArguments(TextualArgumentOptions.EnableEcmaScriptLike)
                       .Select(arg => TextualArgumentUtility.EvaluateCommandLineArgument(arg, TextualArgumentOptions.EnableEcmaScriptLike))
                       .ToArray();

            //var args = argument.Split('?');

            FilePathFormat = args[0].Trim();

            if (args.Length == 1)
            {
                return;
            }

            LoggingLevel level;

            if (!Enum.TryParse(args[1], true, out level))
            {
                level = DefaultLevel;
            }
            Level = level;

            if (args.Length == 2)
            {
                return;
            }
            switch (args.Length)
            {
            case 2:
                return;

            case 3:
                break;

            default:
                throw new ArgumentException();
            }

            TimestampFormat = args[2];
        }
Exemple #2
0
 public void ForEval(TextualArgumentOptions options, string expected, string input)
 {
     Assert.Equal(expected, TextualArgumentUtility.EvaluateCommandLineArgument(input, options));
 }