Пример #1
0
        static void Main(string[] args)
        {
            ILogService logService = new FileLogService(typeof(Program));

            logService.Debug("Debug started");
            logService.Error("Logging Error");
            logService.Fatal("Fatal message");
            Console.WriteLine("Fatal message");
            Console.WriteLine("Debugging");
            Console.ReadLine();
        }
Пример #2
0
        static void Main(string[] args)
        {
            ILogService             logService = new FileLogService(typeof(Program));
            HelloWorldServiceClient client     = new HelloWorldServiceClient();

            logService.Info("Preparing to call the Hello World Service");
            Console.WriteLine(client.GetMessage("Console Client App"));
            logService.Info("Hello World Service has returned");
            Console.WriteLine("Log has been written");
            Console.WriteLine("Press any key to exit...");
            Console.Read();
        }
Пример #3
0
        public IList <DTOOrder> GetRecentByDropShipperId(long dropShipperId)
        {
            var baseLog       = LogManager.GetLogger("RequestLogger");
            var log           = new FileLogService(baseLog, null);
            var dbFactory     = new DbFactory();
            var time          = new TimeService(dbFactory);
            var actionService = new SystemActionService(log, time);
            var orderHistory  = new OrderHistoryService(log, time, dbFactory);

            var dsService = new DropShipperApiService(log, time, dbFactory, actionService, orderHistory);

            return(dsService.GetRecentByDropShipperId(dropShipperId));
        }
Пример #4
0
        public CallResult UpdateShipments(DTOOrder order)
        {
            var baseLog       = LogManager.GetLogger("RequestLogger");
            var log           = new FileLogService(baseLog, null);
            var dbFactory     = new DbFactory();
            var time          = new TimeService(dbFactory);
            var actionService = new SystemActionService(log, time);
            var orderHistory  = new OrderHistoryService(log, time, dbFactory);

            var dsService = new DropShipperApiService(log, time, dbFactory, actionService, orderHistory);

            return(dsService.UpdateShipments(order));
        }
Пример #5
0
        public IList <StyleEntireDto> GetQuantities(int market, string marketplaceId)
        {
            var baseLog       = LogManager.GetLogger("RequestLogger");
            var log           = new FileLogService(baseLog, null);
            var dbFactory     = new DbFactory();
            var time          = new TimeService(dbFactory);
            var actionService = new SystemActionService(log, time);
            var orderHistory  = new OrderHistoryService(log, time, dbFactory);

            var dsService = new DropShipperApiService(log, time, dbFactory, actionService, orderHistory);

            return(dsService.GetQuantities((MarketType)market, marketplaceId));
        }
Пример #6
0
        public void TestLog2DB()
        {
            // Arrange
            var testDbPath = @"MyData.db";

            File.Delete(testDbPath);

            var input   = FileLogService.LoadFromFile(@"..\..\..\..\..\logfile.txt");
            var output  = new LogWriterService(testDbPath, "LogEntries");
            var service = new LogParsingService(input, output, 4);

            // Act
            service.Process();

            // Assert
            var result = output.GetLogEntries();

            Assert.IsTrue(result.Count == 3);
        }
Пример #7
0
        public static void StartService(int port)
        {
            try
            {
                ILogService logService = new FileLogService(typeof(DataEngine));
                logService.Info("启动数据服务引擎...");

                // UriBuilder builder = new UriBuilder(Uri.UriSchemeNetTcp, "localhost", port, "/Data");
                UriBuilder builder = new UriBuilder(Uri.UriSchemeNetPipe, "localhost");

                _host = new ServiceHost(typeof(DataService), builder.Uri);

                ServiceThrottlingBehavior throttling = _host.Description.Behaviors.Find <ServiceThrottlingBehavior>();

                if (throttling != null)
                {
                    throttling.MaxConcurrentSessions = maxConnections;
                }
                else
                {
                    throttling = new ServiceThrottlingBehavior();
                    throttling.MaxConcurrentSessions = maxConnections;

                    _host.Description.Behaviors.Add(throttling);
                }

                //GlobalErrorBehaviorAttribute errorBehavior = _host.Description.Behaviors.Find<GlobalErrorBehaviorAttribute>();
                //if (errorBehavior == null)
                //{
                //    _host.Description.Behaviors.Add(errorBehavior);
                //}

                _host.AddServiceEndpoint(typeof(IDataService), CommunicationSettingsFactory.CreateDataServicePipeBinding(Timeout), "IDataService");
                _host.AddServiceEndpoint(typeof(IPingService), CommunicationSettingsFactory.CreateDataServicePipeBinding(Timeout), "IPingService");
                _host.Open();
            }
            catch (Exception ex)
            {
                _logService.Error(string.Format("ExistCatch:Error:<-{0}->:{1} \r\n Error detail:{2}", "StartService", ex.Message, ex.ToString()));
            }
        }
Пример #8
0
    private void log(LogLevel level, string moduleName, string functionName, string messageType, string message)
    {
        FileLogService service = new FileLogService();

        service.Log(level, "BS", moduleName, functionName, messageType, message);
    }
 public AppAccessTokenManagerService(DALFacade dALFacade)
 {
     _logger    = new FileLogService(typeof(IUserManagerService));
     _dALFacade = dALFacade;
 }
 public UserRepository(TemplateDBContext context)
 {
     _logger  = new FileLogService(typeof(IUserRepository));
     _context = context;
 }
 public SecurityHelper(BLLFacade bLLFacade)
 {
     _logger    = new FileLogService(typeof(ISecurityHelper));
     _bLLFacade = bLLFacade;
 }
 public RegisterdAppActiveService(BLLFacade bLLFacade)
 {
     _logger    = new FileLogService(typeof(IRegisterdAppActiveService));
     _bLLFacade = bLLFacade;
 }
Пример #13
0
 public void TestCleanup()
 {
     _sut = null;
 }
Пример #14
0
 public void TestInitialize()
 {
     _sut = new FileLogService();
 }
Пример #15
0
 public CrewingService(IDbCrewingUnitOfWork crewingUnitOfWork, IMapper mapper)
 {
     this.mapper = mapper;
     uow         = crewingUnitOfWork;
     logService  = new FileLogService();
 }
 public RegisteredAppRepository(TemplateDBContext context)
 {
     _logger  = new FileLogService(typeof(IRegisteredAppRepository));
     _context = context;
 }
 public UserActiveService(BLLFacade bLLFacade)
 {
     _logger    = new FileLogService(typeof(IUserActiveService));
     _bLLFacade = bLLFacade;
 }
Пример #18
0
 public RegisterdAppManagerService(DALFacade dALFacade)
 {
     _logger    = new FileLogService(typeof(IUserManagerService));
     _dALFacade = dALFacade;
 }