Beispiel #1
0
 /// <summary>
 /// Helper method to register a single given <see cref="LogConsumer{TMetaData}"/> to this <see cref="LogRegistration{TMetaData}"/>.
 /// </summary>
 /// <typeparam name="TMetaData">The type that captures metadata about messages.</typeparam>
 /// <param name="registration">This <see cref="LogRegistration{TMetaData}"/>.</param>
 /// <param name="consumer">The single <see cref="LogConsumer{TMetaData}"/>.</param>
 /// <exception cref="NullReferenceException">If this <see cref="LogRegistration{TMetaData}"/> is <c>null</c>.</exception>
 public static void RegisterLogger <TMetaData>(this LogRegistration <TMetaData> registration, LogConsumer <TMetaData> consumer)
 {
     if (consumer != null)
     {
         registration.RegisterLoggers(new LogConsumer <TMetaData>[] { consumer });
     }
 }
Beispiel #2
0
 /// <summary>
 /// Helper method to register a single <see cref="LogConsumer{TMetaData}"/> returned by given <see cref="LogConsumerFactory{TMetaData}"/> to this <see cref="LogRegistration{TMetaData}"/>.
 /// </summary>
 /// <typeparam name="TMetaData">The type that captures metadata about messages.</typeparam>
 /// <param name="registration">This <see cref="LogRegistration{TMetaData}"/>.</param>
 /// <param name="consumerFactory">The single <see cref="LogConsumerFactory{TMetaData}"/>.</param>
 /// <exception cref="NullReferenceException">If this <see cref="LogRegistration{TMetaData}"/> is <c>null</c>.</exception>
 public static void RegisterLogger <TMetaData>(this LogRegistration <TMetaData> registration, LogConsumerFactory <TMetaData> consumerFactory)
 {
     if (consumerFactory != null)
     {
         registration.RegisterLoggers(new LogConsumer <TMetaData>[] { consumerFactory.CreateLogConsumer() });
     }
 }
Beispiel #3
0
 /// <summary>
 /// Helper method to register multiple <see cref="LogConsumer{TMetaData}"/> instances returned by given <see cref="LogConsumerFactory{TMetaData}"/> instances to this <see cref="LogRegistration{TMetaData}"/>.
 /// </summary>
 /// <typeparam name="TMetaData">The type that captures metadata about messages.</typeparam>
 /// <param name="registration">This <see cref="LogRegistration{TMetaData}"/>.</param>
 /// <param name="factories">The <see cref="LogConsumerFactory{TMetaData}"/> instances.</param>
 /// <exception cref="NullReferenceException">If this <see cref="LogRegistration{TMetaData}"/> is <c>null</c>.</exception>
 public static void RegisterLoggers <TMetaData>(this LogRegistration <TMetaData> registration, IEnumerable <LogConsumerFactory <TMetaData> > factories)
 {
     registration.RegisterLoggers(factories.Select(f => f.CreateLogConsumer()));
 }