public static Configurer WithArkDefaultTargetsAndRules(this Configurer @this, string logTableName, string connectionString, string mailFrom, string mailTo, string smtpConnectionString, bool consoleEnabled = false, bool async = true) { if (consoleEnabled) { @this .WithConsoleTarget(async) .WithConsoleRule("*", LogLevel.Trace); } if (!string.IsNullOrWhiteSpace(connectionString)) { @this .WithDatabaseTarget(logTableName, connectionString, async) .WithDatabaseRule("*", LogLevel.Info); } if (!string.IsNullOrWhiteSpace(smtpConnectionString)) { @this .WithMailTarget(mailFrom, mailTo, smtpConnectionString, async: false) .WithMailRule("*", LogLevel.Fatal) ; } if (Debugger.IsAttached) { @this .WithDebuggerTarget() .WithDebuggerRule() ; } return(@this); }
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); }
public static Configurer WithDatabaseTargetFromCloudConfiguration(this Configurer @this, string logTableName, bool async = true) { return(@this.WithDatabaseTarget(logTableName, CloudConfigurationManager.GetSetting(NLogDefaultConfigKeys.SqlConnStringName), async: async)); }
public static Configurer WithDatabaseTargetFromAppSettings(this Configurer @this, string logTableName, bool async = true) { return(@this.WithDatabaseTarget(logTableName, ConfigurationManager.ConnectionStrings[NLogDefaultConfigKeys.SqlConnStringName].ConnectionString, async: async)); }