/// <summary>
 /// Applies the context properties to the specified <paramref name="builder" />.
 /// </summary>
 /// <param name="builder">The builder to copy the properties to.</param>
 public void Apply(ILogBuilder builder)
 {
     foreach (var pair in _dictionary)
     {
         builder.Property(pair.Key, pair.Value);
     }
 }
        /// <summary>
        /// Adds one or more tags to the event.
        /// </summary>
        /// <param name="builder">The log builder object.</param>
        /// <param name="tags">The tags to be added to the event.</param>
        public static ILogBuilder Tag(this ILogBuilder builder, params string[] tags)
        {
            if (builder.LogData == null)
            {
                return(builder);
            }

            if (builder.LogData.Properties == null)
            {
                builder.LogData.Properties = new Dictionary <string, object>();
            }

            var tagList = new List <string>();

            if (builder.LogData.Properties.ContainsKey(Tags) && builder.LogData.Properties[Tags] is List <string> )
            {
                tagList = builder.LogData.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));
        }
        /// <summary>
        /// Applies the context properties to the specified <paramref name="builder" />.
        /// </summary>
        /// <param name="builder">The builder to copy the properties to.</param>
        public void Apply(ILogBuilder builder) {
            var dictionary = GetDictionary();
            if (dictionary == null)
                return;

            foreach (var pair in dictionary)
                builder.Property(pair.Key, pair.Value);
        }
        /// <summary>
        /// Sets the user's identity (ie. email address, username, user id) that the event happened to.
        /// </summary>
        /// <param name="builder">The log builder object.</param>
        /// <param name="identity">The user's identity that the event happened to.</param>
        /// <param name="name">The user's friendly name that the event happened to.</param>
        public static ILogBuilder Identity(this ILogBuilder builder, string identity, string name)
        {
            if (String.IsNullOrWhiteSpace(identity) && String.IsNullOrWhiteSpace(name))
            {
                return(builder);
            }

            return(builder.Property("@user", new { Identity = identity, Name = name }));
        }
        public static ILogBuilder Organization(this ILogBuilder builder, string organizationId)
        {
            if (String.IsNullOrEmpty(organizationId))
            {
                return(builder);
            }

            return(builder.Property("organization", organizationId));
        }
        public static ILogBuilder Project(this ILogBuilder builder, string projectId)
        {
            if (String.IsNullOrEmpty(projectId))
            {
                return(builder);
            }

            return(builder.Property("project", projectId));
        }
        public static ILogBuilder DataSourceInstance(this ILogBuilder builder, string dataSourceInstanceId)
        {
            if (String.IsNullOrEmpty(dataSourceInstanceId))
            {
                return(builder);
            }

            return(builder.Property("datasourceinstance", dataSourceInstanceId));
        }
        /// <summary>
        /// Applies the context properties to the specified <paramref name="builder" />.
        /// </summary>
        /// <param name="builder">The builder to copy the properties to.</param>
        public void Apply(ILogBuilder builder)
        {
            var dictionary = GetDictionary();

            if (dictionary == null)
            {
                return;
            }

            foreach (var pair in dictionary)
            {
                builder.Property(pair.Key, pair.Value);
            }
        }
        public static ILogBuilder Properties(this ILogBuilder builder, ICollection <KeyValuePair <string, string> > collection)
        {
            if (collection == null)
            {
                return(builder);
            }

            foreach (var pair in collection)
            {
                if (pair.Key != null)
                {
                    builder.Property(pair.Key, pair.Value);
                }
            }

            return(builder);
        }
        public static ILogBuilder Tag(this ILogBuilder builder, IEnumerable <string> tags)
        {
            var tagList = new List <string>();

            if (builder.LogData.Properties.ContainsKey("tags") && builder.LogData.Properties["tags"] is List <string> )
            {
                tagList = builder.LogData.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));
        }
 /// <summary>
 /// Applies the context properties to the specified <paramref name="builder" />.
 /// </summary>
 /// <param name="builder">The builder to copy the properties to.</param>
 public void Apply(ILogBuilder builder)
 {
     foreach (var pair in _dictionary)
         builder.Property(pair.Key, pair.Value);
 }
 public static ILogBuilder Value(this ILogBuilder builder, decimal value)
 {
     return(builder.Property("@value", value));
 }
 public static ILogBuilder ManualStackingKey(this ILogBuilder builder, string stackingKey)
 {
     return(builder.Property("@stack", stackingKey));
 }