/// <summary> /// Adds <see cref="TraceSerializer"/> to the <paramref name="logFactory"/>. /// </summary> /// <param name="logFactory">Log factory to extend.</param> /// <param name="formatter">Optional formatter.</param> /// <param name="filter">Optional filter.</param> /// <returns><see cref="ILogFactory.AddSerializer"/>.</returns> public static ILogFactory AddTrace(this ILogFactory logFactory, ILogFormatter formatter = null, ILogFilter filter = null) { Ensure.NotNull(logFactory, "logFactory"); if (filter == null) { filter = AllowedLogFilter.Instance; } if (formatter == null) { formatter = DefaultLogFormatter.Instance; } return(logFactory.AddSerializer(new TraceSerializer(formatter, filter))); }
/// <summary> /// Adds <see cref="TraceSerializer"/> to the <paramref name="logFactory"/>. /// </summary> /// <param name="logFactory">Log factory to extend.</param> /// <param name="formatter">Optional formatter.</param> /// <param name="filter">Optional filter.</param> /// <returns><see cref="ILogFactory.AddSerializer"/>.</returns> public static ILogFactory AddTrace(this ILogFactory logFactory, ILogFormatter formatter = null, ILogFilter filter = null) { Ensure.NotNull(logFactory, "logFactory"); ILogSerializer serializer; if (formatter == null) { serializer = new TraceSerializer(); } else { serializer = new TraceSerializer(formatter, filter ?? new AllowedLogFilter()); } return(logFactory.AddSerializer(serializer)); }
/// <summary> /// Adds <see cref="Log4netSerializer"/> the to <paramref name="logFactory"/>. /// </summary> /// <param name="logFactory">Log factory to extend.</param> /// <param name="formatter">Optional formatter.</param> /// <returns><see cref="ILogFactory.AddSerializer"/>.</returns> public static ILogFactory AddLog4net(this ILogFactory logFactory, ILogFormatter formatter = null) { Ensure.NotNull(logFactory, "logFactory"); ILogSerializer serializer; if (formatter == null) { serializer = new Log4netSerializer(); } else { serializer = new Log4netSerializer(formatter); } return(logFactory.AddSerializer(serializer)); }