Ejemplo n.º 1
0
        public static LogManager ConfigureForTextWriter(StringWriter tw)
        {
            var twTarg =
                TextWriter.Create(
                    TextWriter.TextWriterConf.Create(tw, tw,
                                                     new Microsoft.FSharp.Core.FSharpOption <Formatting.StringFormatter>(Formatting.StringFormatterModule.levelDatetimeMessagePathNl),
                                                     new Microsoft.FSharp.Core.FSharpOption <object>(new object())),
                    "tw");

            var twRule =
                RuleModule.Create(new Regex(@"^Logary\.CSharp\.Tests"), "tw", LogLevel.Verbose,
                                  message => true);

            var internalTarg = Console.Create(Console.empty, "console");

            return(Config.Configure(
                       "Logary.CSharp.Tests C# low level API",
                       new[] { twTarg },
                       new Metric.MetricConf[0],
                       new[] { twRule },
                       LogLevel.Warn,
                       internalTarg)
                   .ToTask()
                   .Result);
        }
Ejemplo n.º 2
0
        public static LogManager ConfigureForTextWriter(StringWriter tw)
        {
            var twTarg =
                TextWriter.Create(
                    TextWriter.TextWriterConf.Create(tw, tw,
                                                     new Microsoft.FSharp.Core.FSharpOption <MessageWriter>(MessageWriterModule.levelDatetimeMessagePathNewLine)),
                    "tw");

            var config = Config.create("Logary.CSharp.Tests C# low level API", "localhost");

            config = Config.ilogger(ILogger.NewConsole(LogLevel.Warn), config);
            config = Config.target(twTarg, config);
            config = Config.loggerMinLevel(".*", LogLevel.Verbose, config);
            var logary = Config.build(config).ToTask().Result;

            return(logary);
        }