public static LogBuilder Project(this LogBuilder builder, string projectId) { if (String.IsNullOrEmpty(projectId)) { return(builder); } return(builder.Property("project", projectId)); }
public static LogBuilder Organization(this LogBuilder builder, string organizationId) { if (String.IsNullOrEmpty(organizationId)) { return(builder); } return(builder.Property("organization", organizationId)); }
private static LogBuilder Create(LogLevel logLevel, string callerFilePath) { string name = Path.GetFileNameWithoutExtension(callerFilePath ?? string.Empty); var logger = string.IsNullOrWhiteSpace(name) ? _logger : LogManager.GetLogger(name); var builder = new LogBuilder(logger, logLevel); if (callerFilePath != null) builder.Property("CallerFilePath", callerFilePath); return builder; }
private static LogBuilder Create(LogLevel logLevel, string callerFilePath) { var logger = GetLogger(callerFilePath); var builder = new LogBuilder(logger, logLevel); if (callerFilePath != null) { builder.Property("CallerFilePath", callerFilePath); } return(builder); }
public static LogBuilder Tag(this LogBuilder builder, IEnumerable <string> tags) { var tagList = new List <string>(); if (builder.LogEventInfo.Properties.ContainsKey("tags") && builder.LogEventInfo.Properties["tags"] is List <string> ) { tagList = builder.LogEventInfo.Properties["tags"] as List <string>; } foreach (string tag in tags) { if (!tagList.Any(s => s.Equals(tag, StringComparison.OrdinalIgnoreCase))) { tagList.Add(tag); } } return(builder.Property("tags", tagList)); }
private static LogBuilder Create(LogLevel logLevel, string callerFilePath) { string name = Path.GetFileNameWithoutExtension(callerFilePath ?? string.Empty); var logger = string.IsNullOrWhiteSpace(name) ? _logger : LogManager.GetLogger(name); var builder = new LogBuilder(logger, logLevel); if (callerFilePath != null) builder.Property("CallerFilePath", callerFilePath); return builder; }
public void LogBuilder_null_lead_to_ArgumentNullException() { var logger = LogManager.GetLogger("a"); Assert.Throws<ArgumentNullException>(() => new LogBuilder(null, LogLevel.Debug)); Assert.Throws<ArgumentNullException>(() => new LogBuilder(null)); Assert.Throws<ArgumentNullException>(() => new LogBuilder(logger, null)); var logBuilder = new LogBuilder(logger); Assert.Throws<ArgumentNullException>(() => logBuilder.Properties(null)); Assert.Throws<ArgumentNullException>(() => logBuilder.Property(null, "b")); }
public static LogBuilder Project(this LogBuilder builder, string projectId) { return(builder.Property("project", projectId)); }
public static LogBuilder Organization(this LogBuilder builder, string organizationId) { return(builder.Property("organization", organizationId)); }