public static LoggingPolicy Use(this LoggingPolicy source, ILogger logger) { Guard.NotNull("logger", logger); return(new LoggingPolicy(source, new List <ILogger> { logger })); }
public static LoggingPolicy Use <TLogger>(this LoggingPolicy source, Func <TLogger> loggerFactory) where TLogger : class, ILogger { Guard.NotNull("loggerFactory", loggerFactory); return(new LoggingPolicy(source, new List <ILogger> { loggerFactory.Invoke() })); }
public static LoggingPolicy UseInLine(this LoggingPolicy source, params Action <string>[] logAction) { Guard.NotNull("logAction", logAction); var lambdaLoggers = logAction.Select(logContext => new ActionLogger(logContext)).OfType <ILogger>().ToList(); return(new LoggingPolicy(source, lambdaLoggers)); }
public InitLogging WithPolicy(Action <ILoggingPolicyFor> action) { var policy = new LoggingPolicy(); action(policy); this.policies.Add(policy); return(this); }
internal LoggingPolicy(LoggingPolicy sourceLoggingPolicy, List <ILogger> loggers) : this(sourceLoggingPolicy.supportedTypes) { Guard.NotNull("sourceLoggingPolicy", sourceLoggingPolicy); Guard.NotNull("loggers", loggers); this.logContexts.AddRange(sourceLoggingPolicy.logContexts); foreach (var logger in loggers) { this.logContexts.Add(logger); } }