diff --git a/core/StreamConfig.cs b/core/StreamConfig.cs index c92ab851..664f06c9 100644 --- a/core/StreamConfig.cs +++ b/core/StreamConfig.cs @@ -2282,7 +2282,7 @@ public StreamConfig() /// /// /// Dictionary of stream properties - public StreamConfig(IDictionary properties) + public StreamConfig(IDictionary properties, ILoggerFactory loggerFactory = null) { InitializeReflectedProperties(); @@ -2329,17 +2329,22 @@ public StreamConfig(IDictionary properties) PartitionAssignmentStrategy = Confluent.Kafka.PartitionAssignmentStrategy.Range; Partitioner = Confluent.Kafka.Partitioner.Murmur2Random; - Logger = LoggerFactory.Create(builder => - { - builder.SetMinimumLevel(LogLevel.Information); - builder.AddConsole(); - }); - + Logger = loggerFactory; + if (properties != null) { foreach (var k in properties) AddConfig(k.Key, k.Value); } + + if (Logger != null) + return; + + Logger = LoggerFactory.Create(builder => + { + builder.SetMinimumLevel(LogLevel.Information); + builder.AddConsole(); + }); } #endregion @@ -3403,8 +3408,9 @@ public StreamConfig() : this(null) { } /// /// /// Dictionary of stream properties - public StreamConfig(IDictionary properties) - : base(properties) + /// LoggerFactory for creating loggers. If not provided new instance will be created + public StreamConfig(IDictionary properties, ILoggerFactory loggerFactory = null) + : base(properties, loggerFactory) { DefaultKeySerDes = new KS(); DefaultValueSerDes = new VS();