Пример #1
0
 public static LoggerConfiguration SherlockSink(
     this LoggerSinkConfiguration loggerConfiguration,
     ISherlockClient client,
     int flushTimeout,
     IFormatProvider formatProvider = null)
 {
     return(loggerConfiguration.Sink(new SherlockEventSink(client, flushTimeout, formatProvider)));
 }
Пример #2
0
        public static void Start(ISherlockClient client)
        {
            SherlockClient = client;

            _reporter = Actor.SpawnNamed(
                Actor.FromProducer(() => new BackgroundMessagesReporter(client)),
                "sherlock-reporter"
                );
        }
Пример #3
0
 public SherlockBackgroundLogReporter(
     ISherlockClient client,
     IFormatProvider formatProvider,
     int flushInterval
     )
 {
     _client         = client;
     _formatProvider = formatProvider;
     _flushInterval  = flushInterval;
 }
Пример #4
0
        public DemoEngine(ISherlockClient client)
        {
            var props = Actor.FromProducer(() => new DemoRootActor());

            _root = Actor.SpawnNamed(props, "Demo");

            _sherlock = Actor.SpawnNamed(
                Actor.FromProducer(() => new ProtoActor.SherlockInspectionActor(new SimpleScheduler(), client)),
                "Sherlock"
                );

            _sherlock.Tell(new AddToInspection()
            {
                Actor = _root
            });
        }
Пример #5
0
        private static void ConfigureLogging()
        {
            var serilogConfig = new LoggerConfiguration()
                                .ReadFrom.Configuration(_config);

            var sherlockOptions = SherlockDemoClientOptions.LoadFrom(_config);

            if (sherlockOptions.Enabled)
            {
                SherlockSettings.Enable();

                _sherlockClient = new SherlockClient(sherlockOptions);
                serilogConfig   = serilogConfig.WriteTo.SherlockSink(_sherlockClient, sherlockOptions.FlushIntervalSeconds);

                ActorMessages.Start(_sherlockClient);
            }

            Log.Logger = serilogConfig.CreateLogger();
            Proto.Log.SetLoggerFactory(new LoggerFactory().AddSerilog());
        }
Пример #6
0
 public SherlockEventSink(ISherlockClient client, int flushTimeout, IFormatProvider formatProvider)
 {
     _reporter = Actor.Spawn(Actor.FromProducer(() => new SherlockBackgroundLogReporter(client, formatProvider, flushTimeout)));
 }
Пример #7
0
 public SherlockInspectionActor(ISimpleScheduler scheduler, ISherlockClient client)
 {
     _scheduler = scheduler;
     _client    = client;
 }
Пример #8
0
 public BackgroundMessagesReporter(ISherlockClient client)
 {
     _client    = client;
     _scheduler = new SimpleScheduler();
 }