Example #1
0
        public static ContainerBuilder AddLogging(this ContainerBuilder builder, Action <IPipelineComponent <Log, Log>, IComponentContext> configure)
        {
            builder.Register(context =>
            {
                IPipelineComponent <Log, Log> pipeline = PipelineComponent.CreateIdentity <Log>();

                configure?.Invoke(pipeline, context);

                return(new Logger(pipeline));
            }).As <ILogger>().SingleInstance();

            builder.RegisterGeneric(typeof(Logger <>))
            .As(typeof(ILogger <>))
            .InstancePerDependency();

            return(builder);
        }