Ejemplo n.º 1
0
        /// <summary>
        /// Graylogs the specified hostname or address.
        /// </summary>
        /// <param name="loggerSinkConfiguration">The logger sink configuration.</param>
        /// <param name="hostnameOrAddress">The hostname or address.</param>
        /// <param name="port">The port.</param>
        /// <param name="transportType">Type of the transport.</param>
        /// <param name="minimumLogEventLevel">The minimum log event level.</param>
        /// <param name="messageIdGeneratorType">Type of the message identifier generator.</param>
        /// <param name="shortMessageMaxLength">Short length of the message maximum.</param>
        /// <param name="stackTraceDepth">The stack trace depth.</param>
        /// <param name="facility">The facility.</param>
        /// <param name="propertyNamingStrategy"></param>
        /// <param name="period"></param>
        /// <param name="batchPostingLimit"></param>
        /// <returns></returns>
        public static LoggerConfiguration Graylog(
            this LoggerSinkConfiguration loggerSinkConfiguration,
            string hostnameOrAddress,
            int port,
            TransportType transportType,
            LogEventLevel minimumLogEventLevel            = LevelAlias.Minimum,
            MessageIdGeneratortype messageIdGeneratorType = GraylogSinkOptions.DefaultMessageGeneratorType,
            int shortMessageMaxLength = GraylogSinkOptions.DefaultShortMessageMaxLength,
            int stackTraceDepth       = GraylogSinkOptions.DefaultStackTraceDepth,
            string facility           = GraylogSinkOptions.DefaultFacility,
            IPropertyNamingStrategy propertyNamingStrategy = null,
            TimeSpan?period       = null,
            int batchPostingLimit = GraylogSinkOptions.DefaultBatchPostingLimit
            )
        {
            var options = new GraylogSinkOptions
            {
                HostnameOrAddress = hostnameOrAddress,
                Port                   = port,
                TransportType          = transportType,
                MinimumLogEventLevel   = minimumLogEventLevel,
                MessageGeneratorType   = messageIdGeneratorType,
                ShortMessageMaxLength  = shortMessageMaxLength,
                StackTraceDepth        = stackTraceDepth,
                Facility               = facility,
                PropertyNamingStrategy = propertyNamingStrategy ?? new NoOpPropertyNamingStrategy(),
                Period                 = period ?? GraylogSinkOptions.DefaultPeriod,
                BatchSizeLimit         = batchPostingLimit
            };

            return(loggerSinkConfiguration.Graylog(options));
        }
Ejemplo n.º 2
0
 public void SetPropertyNamingStrategy(IPropertyNamingStrategy namingStrategy, bool clearExistingMetaData)
 {
     _propertyNamingStrategy = namingStrategy;
     if (clearExistingMetaData)
     {
         _cache.Clear();
     }
 }
 public TypeDataRepository(IConfiguration config)
 {
     _config = config;
     _cache = new Dictionary<Type, TypeData>();
     _attributeProcessors = new List<AttributeProcessor>();
     _attributeProcessors.Add(new JsonIgnoreAttributeProcessor());
     _attributeProcessors.Add(new JsonPropertyAttributeProcessor());
     _attributeProcessors.Add(new JsonDefaultAttributeProcessor());
     _attributeProcessors.Add(new ConstructorParameterAttributeProcessor());
     _attributeProcessors.Add(new TypeConverterAttributeProcessor());
     _attributeProcessors.Add(new JsonCollectionAttributeProcessor());
     _propertyNamingStrategy = new DefaultPropertyNamingStrategy();
 }
Ejemplo n.º 4
0
 public TypeDataRepository(ISerializerSettings config)
 {
     _config = config;
     _cache  = new Dictionary <Type, ITypeData>();
     _attributeProcessors = new List <AttributeProcessor>();
     _attributeProcessors.Add(new JsonIgnoreAttributeProcessor());
     _attributeProcessors.Add(new JsonPropertyAttributeProcessor());
     _attributeProcessors.Add(new JsonDefaultAttributeProcessor());
     _attributeProcessors.Add(new ConstructorParameterAttributeProcessor());
     _attributeProcessors.Add(new TypeConverterAttributeProcessor());
     _attributeProcessors.Add(new JsonCollectionAttributeProcessor());
     _propertyNamingStrategy = new DefaultPropertyNamingStrategy();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GelfMessageBuilder"/> class.
 /// </summary>
 /// <param name="hostName">Name of the host.</param>
 /// <param name="options">The options.</param>
 public GelfMessageBuilder(string hostName = null, GraylogSinkOptions options = null)
 {
     Options                = options ?? new GraylogSinkOptions();
     this.hostName          = string.IsNullOrWhiteSpace(hostName) ? "localhost" : hostName;
     propertyNamingStrategy = options.PropertyNamingStrategy ?? new NoOpPropertyNamingStrategy();
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GelfMessageBuilder"/> class.
 /// </summary>
 /// <param name="hostName">Name of the host.</param>
 /// <param name="options">The options.</param>
 public GelfMessageBuilder(string hostName, GraylogSinkOptions options)
 {
     _hostName = hostName;
     Options   = options;
     _propertyNamingStrategy = options.PropertyNamingStrategy;
 }
 public void SetPropertyNamingStrategy(IPropertyNamingStrategy namingStrategy, bool clearExistingMetaData)
 {
     _propertyNamingStrategy = namingStrategy;
     if (clearExistingMetaData)
         _cache.Clear();
 }
 public void SetPropertyNamingStrategy(IPropertyNamingStrategy namingStrategy)
 {
     SetPropertyNamingStrategy(namingStrategy, true);
 }
Ejemplo n.º 9
0
 public void SetPropertyNamingStrategy(IPropertyNamingStrategy namingStrategy)
 {
     SetPropertyNamingStrategy(namingStrategy, true);
 }