Esempio n. 1
0
        public static IoC Create()
        {

            var ioc = new IoC();
            var log = new LogToConsole();

            ioc.Register<ILog>(log);

            AzureRepoBinder.BindAzureReposInMem(ioc);
            SrvBinder.BindTraderPortalServices(ioc);

            return ioc;

        }
        public static IoC Create()
        {

            var ioc = new IoC();
            var log = new LogToConsole();

            ioc.Register<ILog>(log);

            ioc.BindAzureReposInMem();
            SrvBinder.BindTraderPortalServices(ioc);

            ioc.RegisterSingleTone<OrderBookChangesRegistrator>();
            ioc.SelfBond<IOrderBookChangesConsumer, OrderBookChangesRegistrator>();

            ioc.RegisterSingleTone<AssetPairBestPricesChangesRegistrator>();
            ioc.SelfBond<IAssetPairBestPriceNotifier, AssetPairBestPricesChangesRegistrator>();

            return ioc;

        }
Esempio n. 3
0
        private static Common.Log.ILog CreateLogWithSlack(IServiceCollection services, IReloadingManager <Settings> appSettings)

        {
            var consoleLogger = new LogToConsole();

            var aggregateLogger = new AggregateLogger();



            aggregateLogger.AddLog(consoleLogger);



            // Creating slack notification service, which logs own azure queue processing messages to aggregate log

            var slackService = services.UseSlackNotificationsSenderViaAzureQueue(new Lykke.AzureQueueIntegration.AzureQueueSettings

            {
                ConnectionString = appSettings.CurrentValue.PayApi.Db.LogsConnString,

                QueueName = appSettings.CurrentValue.SlackNotifications.AzureQueue.QueueName
            }, aggregateLogger);



            var dbLogConnectionStringManager = appSettings.Nested(x => x.PayApi.Db.LogsConnString);

            var dbLogConnectionString = dbLogConnectionStringManager.CurrentValue;



            // Creating azure storage logger, which logs own messages to concole log

            if (!string.IsNullOrEmpty(dbLogConnectionString) && !(dbLogConnectionString.StartsWith("${") && dbLogConnectionString.EndsWith("}")))

            {
                var persistenceManager = new LykkeLogToAzureStoragePersistenceManager("LykkePayApi",

                                                                                      AzureStorage.Tables.AzureTableStorage <Lykke.Logs.LogEntity> .Create(dbLogConnectionStringManager, "LykkePayApiLog", consoleLogger),

                                                                                      consoleLogger);



                var slackNotificationsManager = new LykkeLogToAzureSlackNotificationsManager(slackService, consoleLogger);



                var azureStorageLogger = new LykkeLogToAzureStorage(

                    persistenceManager,

                    slackNotificationsManager,

                    consoleLogger);



                azureStorageLogger.Start();



                aggregateLogger.AddLog(azureStorageLogger);
            }



            return(aggregateLogger);
        }