Esempio n. 1
0
 public static Configurer WithDefaultRules(this Configurer @this)
 {
     return(@this.WithConsoleRule("*", LogLevel.Trace)
            .WithDatabaseRule("*", LogLevel.Info)
            .WithMailRule("*", LogLevel.Fatal)
            );
 }
Esempio n. 2
0
        public static Configurer WithArkDefaultTargetsAndRules(this Configurer @this, string logTableName, string connectionString, string mailFrom, string mailTo, bool isProduction = true, bool async = true)
        {
            @this.WithConsoleTarget(async);

            if (!isProduction)
            {
                @this.WithConsoleRule("*", LogLevel.Trace);
            }
            else
            {
                @this.WithConsoleRule("*", LogLevel.Warn);
            }

            if (!string.IsNullOrWhiteSpace(connectionString))
            {
                @this
                .WithDatabaseTarget(logTableName, connectionString, async)
                .WithDatabaseRule("*", LogLevel.Info);
            }

            // assume system.mail

            @this
            .WithMailTarget(mailFrom, mailTo, async: false)
            .WithMailRule("*", LogLevel.Fatal)
            ;

            if (Debugger.IsAttached)
            {
                @this
                .WithDebuggerTarget()
                .WithDebuggerRule()
                ;
            }

            return(@this);
        }