Пример #1
0
        public SendMessageBehavior(LogBuilder logBuilder)
        {
            var templateParser = new MessageTemplateParser();

            logger          = logBuilder.GetLogger("NServiceBus.Serilog.MessageSent");
            messageTemplate = templateParser.Parse("Sent message {MessageType} {MessageId}.");
        }
Пример #2
0
        public ReceiveMessageBehavior(LogBuilder logBuilder)
        {
            var templateParser = new MessageTemplateParser();

            messageTemplate = templateParser.Parse("Receive message {MessageType} {MessageId}.");
            logger          = logBuilder.GetLogger("NServiceBus.Serilog.MessageReceived");
        }
Пример #3
0
        public CaptureSagaStateBehavior(LogBuilder logBuilder)
        {
            var templateParser = new MessageTemplateParser();

            messageTemplate = templateParser.Parse("Saga execution '{SagaType}' '{SagaId}'.");

            logger = logBuilder.GetLogger("NServiceBus.Serilog.SagaAudit");
        }
Пример #4
0
        /// <summary>
        /// <see cref="Feature.Setup"/>
        /// </summary>
        protected override void Setup(FeatureConfigurationContext context)
        {
            Guard.AgainstNull(context, "context");

            if (!context.Settings.TryGetSerilogTracingTarget(out var logger))
            {
                logger = Log.Logger;
            }
            //TODO: don't use container
            var logBuilder = new LogBuilder(logger, context.Settings.EndpointName());

            context.Container.ConfigureComponent(() => logBuilder, DependencyLifecycle.SingleInstance);

            var pipeline = context.Pipeline;

            pipeline.Register <ReceiveMessageBehavior.Registration>();
            pipeline.Register <SendMessageBehavior.Registration>();
        }