当前位置: 首页>>代码示例>>C#>>正文


C# ILogger类代码示例

本文整理汇总了C#中ILogger的典型用法代码示例。如果您正苦于以下问题:C# ILogger类的具体用法?C# ILogger怎么用?C# ILogger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ILogger类属于命名空间,在下文中一共展示了ILogger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Context

        protected override void Context()
        {
            AccountService = MockRepository.GenerateStub<IAccountService>();

            Identity = new FakeIdentity(Username);
            _user = new FakePrincipal(Identity, null);

            HttpRequest = MockRepository.GenerateStub<HttpRequestBase>();
            HttpContext = MockRepository.GenerateStub<HttpContextBase>();
            HttpContext.Stub(x => x.Request).Return(HttpRequest);
            HttpContext.User = _user;

            _httpResponse = MockRepository.GenerateStub<HttpResponseBase>();
            _httpResponse.Stub(x => x.Cookies).Return(new HttpCookieCollection());
            HttpContext.Stub(x => x.Response).Return(_httpResponse);

            Logger = MockRepository.GenerateStub<ILogger>();
            WebAuthenticationService = MockRepository.GenerateStub<IWebAuthenticationService>();

            MappingEngine = MockRepository.GenerateStub<IMappingEngine>();
            AccountCreator = MockRepository.GenerateStub<IAccountCreator>();

            AccountController = new AccountController(AccountService, Logger, WebAuthenticationService, MappingEngine, null, AccountCreator);
            AccountController.ControllerContext = new ControllerContext(HttpContext, new RouteData(), AccountController);
        }
开发者ID:AcklenAvenue,项目名称:PRTools,代码行数:25,代码来源:given_an_account_controller_context.cs

示例2: RetryHandler

 /// <summary>
 /// Initializes a new instance of the <see cref="RetryHandler" /> class.
 /// </summary>
 /// <param name="innerHandler">The inner handler. (Usually new HttpClientHandler())</param>
 /// <param name="maxRetries">The maximum retries.</param>
 /// <param name="retryDelayMilliseconds">The retry delay milliseconds.</param>
 /// <param name="logger">The optional logger to log error messages to.</param>
 /// <remarks>
 /// When only the auth0 token provider is injected, the auth0 token provider should try to extract the client id from the 401 response header.
 /// </remarks>
 public RetryHandler(HttpMessageHandler innerHandler, uint maxRetries = 1, uint retryDelayMilliseconds = 500, ILogger logger = null)
     : base(innerHandler)
 {
     this.maxRetries = maxRetries;
     this.retryDelayMilliseconds = retryDelayMilliseconds;
     this.logger = logger;
 }
开发者ID:Cimpress-MCP,项目名称:dotnet-core-httputils,代码行数:17,代码来源:RetryHandler.cs

示例3: WebApplicationComponent

 //-----------------------------------------------------------------------------------------------------------------------------------------------------
 public WebApplicationComponent(IWebAppEndpoint endpoint, Auto<ILogger> logger, IComponentContext componentContext)
 {
     _app = endpoint.Contract;
     _address = endpoint.Address;
     _logger = logger.Instance;
     _container = (ILifetimeScope)componentContext;
 }
开发者ID:votrongdao,项目名称:NWheels,代码行数:8,代码来源:WebApplicationComponent.cs

示例4: Create

        /// <summary>
        /// Creates a deployer instance based on settings in <see cref="DeploymentParameters"/>.
        /// </summary>
        /// <param name="deploymentParameters"></param>
        /// <param name="logger"></param>
        /// <returns></returns>
        public static IApplicationDeployer Create(DeploymentParameters deploymentParameters, ILogger logger)
        {
            if (deploymentParameters == null)
            {
                throw new ArgumentNullException(nameof(deploymentParameters));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            if (deploymentParameters.RuntimeFlavor == RuntimeFlavor.Mono)
            {
                return new MonoDeployer(deploymentParameters, logger);
            }

            switch (deploymentParameters.ServerType)
            {
                case ServerType.IISExpress:
                    return new IISExpressDeployer(deploymentParameters, logger);
#if NET451
                case ServerType.IIS:
                    return new IISDeployer(deploymentParameters, logger);
#endif
                case ServerType.WebListener:
                case ServerType.Kestrel:
                    return new SelfHostDeployer(deploymentParameters, logger);
                default:
                    throw new NotSupportedException(
                        string.Format("Found no deployers suitable for server type '{0}' with the current runtime.", 
                        deploymentParameters.ServerType)
                        );
            }
        }
开发者ID:yonglehou,项目名称:Hosting,代码行数:41,代码来源:ApplicationDeployerFactory.cs

示例5: MessageListViewModel

        public MessageListViewModel(
            MessageRepository messageRepository,
            [NotNull] MessageWatcher messageWatcher,
            MimeMessageLoader mimeMessageLoader,
            IPublishEvent publishEvent,
            ILogger logger)
        {
            if (messageRepository == null)
                throw new ArgumentNullException(nameof(messageRepository));
            if (messageWatcher == null)
                throw new ArgumentNullException(nameof(messageWatcher));
            if (mimeMessageLoader == null)
                throw new ArgumentNullException(nameof(mimeMessageLoader));
            if (publishEvent == null)
                throw new ArgumentNullException(nameof(publishEvent));

            _messageRepository = messageRepository;
            _messageWatcher = messageWatcher;
            _mimeMessageLoader = mimeMessageLoader;
            _publishEvent = publishEvent;
            _logger = logger;

            SetupMessages();
            RefreshMessageList();
        }
开发者ID:Jaben,项目名称:Papercut,代码行数:25,代码来源:MessageListViewModel.cs

示例6: InstallWalker

        public InstallWalker(IPackageRepository localRepository,
                             IPackageRepository sourceRepository,
                             IPackageConstraintProvider constraintProvider,
                             FrameworkName targetFramework,
                             ILogger logger,
                             bool ignoreDependencies,
                             bool allowPrereleaseVersions)
            : base(targetFramework)
        {

            if (sourceRepository == null)
            {
                throw new ArgumentNullException("sourceRepository");
            }
            if (localRepository == null)
            {
                throw new ArgumentNullException("localRepository");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            Repository = localRepository;
            Logger = logger;
            SourceRepository = sourceRepository;
            _ignoreDependencies = ignoreDependencies;
            ConstraintProvider = constraintProvider;
            _operations = new OperationLookup();
            _allowPrereleaseVersions = allowPrereleaseVersions;
        }
开发者ID:nickfloyd,项目名称:NuGet,代码行数:31,代码来源:InstallWalker.cs

示例7: PaymentPayPalStandardController

 public PaymentPayPalStandardController(IWorkContext workContext,
     IStoreService storeService, 
     ISettingService settingService, 
     IPaymentService paymentService, 
     IOrderService orderService, 
     IOrderProcessingService orderProcessingService,
     ILocalizationService localizationService,
     IStoreContext storeContext,
     ILogger logger, 
     IWebHelper webHelper,
     PaymentSettings paymentSettings,
     PayPalStandardPaymentSettings payPalStandardPaymentSettings)
 {
     this._workContext = workContext;
     this._storeService = storeService;
     this._settingService = settingService;
     this._paymentService = paymentService;
     this._orderService = orderService;
     this._orderProcessingService = orderProcessingService;
     this._localizationService = localizationService;
     this._storeContext = storeContext;
     this._logger = logger;
     this._webHelper = webHelper;
     this._paymentSettings = paymentSettings;
     this._payPalStandardPaymentSettings = payPalStandardPaymentSettings;
 }
开发者ID:jianghaihui,项目名称:nopCommerce,代码行数:26,代码来源:PaymentPayPalStandardController.cs

示例8: SerializationProcessor

 public SerializationProcessor(string signKeyFile, List<string> references, List<AssemblyDefinition> memoryReferences, ILogger log)
 {
     SignKeyFile = signKeyFile;
     References = references;
     MemoryReferences = memoryReferences;
     Log = log;
 }
开发者ID:releed,项目名称:paradox,代码行数:7,代码来源:SerializationProcessor.cs

示例9: LogResponse

        /// <summary>
        /// Logs the response.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="statusCode">The status code.</param>
        /// <param name="url">The URL.</param>
        /// <param name="endPoint">The end point.</param>
        /// <param name="duration">The duration.</param>
        public static void LogResponse(ILogger logger, int statusCode, string url, string endPoint, TimeSpan duration)
        {
            var durationMs = duration.TotalMilliseconds;
            var logSuffix = durationMs >= 1000 ? "ms (slow)" : "ms";

            logger.Info("HTTP Response {0} to {1}. Time: {2}{3}. {4}", statusCode, endPoint, Convert.ToInt32(durationMs).ToString(CultureInfo.InvariantCulture), logSuffix, url);
        }
开发者ID:rezafouladian,项目名称:Emby,代码行数:15,代码来源:LoggerUtils.cs

示例10: SessionHandler

        public SessionHandler(ILogger<SessionHandler> logger,
            IEnvironment environment,
            IFileSystem fileSystem,
            IKeyValueStore keyValueStore,
            IMessageBus messageBus,
            ISession session,
            ITorrentInfoRepository torrentInfoRepository,
            ITorrentMetadataRepository metadataRepository)
        {
            if (logger == null) throw new ArgumentNullException("logger");
            if (environment == null) throw new ArgumentNullException("environment");
            if (fileSystem == null) throw new ArgumentNullException("fileSystem");
            if (keyValueStore == null) throw new ArgumentNullException("keyValueStore");
            if (messageBus == null) throw new ArgumentNullException("messageBus");
            if (session == null) throw new ArgumentNullException("session");
            if (torrentInfoRepository == null) throw new ArgumentNullException("torrentInfoRepository");
            if (metadataRepository == null) throw new ArgumentNullException("metadataRepository");

            _logger = logger;
            _environment = environment;
            _fileSystem = fileSystem;
            _keyValueStore = keyValueStore;
            _messageBus = messageBus;
            _session = session;
            _torrentInfoRepository = torrentInfoRepository;
            _metadataRepository = metadataRepository;
            _muted = new List<string>();
            _alertsThread = new Thread(ReadAlerts);
        }
开发者ID:originalmoose,项目名称:hadouken,代码行数:29,代码来源:SessionHandler.cs

示例11: ImageSaver

 /// <summary>
 /// Initializes a new instance of the <see cref="ImageSaver" /> class.
 /// </summary>
 /// <param name="config">The config.</param>
 /// <param name="libraryMonitor">The directory watchers.</param>
 /// <param name="fileSystem">The file system.</param>
 /// <param name="logger">The logger.</param>
 public ImageSaver(IServerConfigurationManager config, ILibraryMonitor libraryMonitor, IFileSystem fileSystem, ILogger logger)
 {
     _config = config;
     _libraryMonitor = libraryMonitor;
     _fileSystem = fileSystem;
     _logger = logger;
 }
开发者ID:loose-wardrobe,项目名称:Emby,代码行数:14,代码来源:ImageSaver.cs

示例12: ApplyMaximumsTask

        public ApplyMaximumsTask(IRepository<AUMaxBidJobControlRecord> maxbidjobcontrolRepo,
                                        IRepository<AUMaxBidRecord> maxbidRepo,
                                        IRepository<AULotLastBidChangeRecord> lotlastbidchangeRepo,

                                        ILogger logger, 
                                        IConsignorService consignorService, 
                                        ICustomerService customerService, 
                                        IQueuedEmailService queuedEmailService,
                                        IEmailAccountService emailAccountService,
                                        EmailAccountSettings emailAccountSettings,
                                        IAUCatalogService AUcatalogService,
                                        ILotService lotService)
        {
            //this._customerService = customerService;
            this._logger = logger;
            this._maxbidjobcontrolRepo = maxbidjobcontrolRepo;
            this._maxbidRepo = maxbidRepo;
            this._lotlastbidchangeRepo = lotlastbidchangeRepo;
            this._consignorService = consignorService;
            this._customerService = customerService;
            this._queuedEmailService = queuedEmailService;
            this._emailAccountService = emailAccountService;
            this._emailAccountSettings = emailAccountSettings;
            this._AUcatalogService = AUcatalogService;
            this._lotService = lotService;
        }
开发者ID:HumanSystems,项目名称:nopcommerce-dev,代码行数:26,代码来源:ApplyMaximumsTask.cs

示例13: SqsQueueDynamoDbCircuitBreaker

 public SqsQueueDynamoDbCircuitBreaker(IAmazonSQS queueClient, string queueName, int breakerTripQueueSize, ILogger structuredLogger)
 {
     this.structuredLogger = structuredLogger;
     this.breakerTripQueueSize = breakerTripQueueSize;
     this.queueClient = queueClient;
     this.queueName = queueName;
 }
开发者ID:litmus,项目名称:DynamoDbAutoscaler,代码行数:7,代码来源:SqsQueueDynamoDbCircuitBreaker.cs

示例14: ConnectInfoForm

        public ConnectInfoForm()
        {
            XmlConfigurator.Configure();

            var settings = new NinjectSettings()
            {
                LoadExtensions = false
            };

            this.mKernel = new StandardKernel(
                settings,
                new Log4NetModule(),
                new ReportServerRepositoryModule());

            //this.mKernel.Load<FuncModule>();

            this.mLoggerFactory = this.mKernel.Get<ILoggerFactory>();
            this.mFileSystem = this.mKernel.Get<IFileSystem>();
            this.mLogger = this.mLoggerFactory.GetCurrentClassLogger();

            InitializeComponent();

            this.LoadSettings();

            // Create the DebugForm and hide it if debug is False
            this.mDebugForm = new DebugForm();
            this.mDebugForm.Show();
            if (!this.mDebug)
                this.mDebugForm.Hide();
        }
开发者ID:jpann,项目名称:SSRSMigrate,代码行数:30,代码来源:ConnectInfoForm.cs

示例15: RazorViewEngine

        /// <summary>
        /// Initializes a new instance of the <see cref="RazorViewEngine" />.
        /// </summary>
        public RazorViewEngine(
            IRazorPageFactoryProvider pageFactory,
            IRazorPageActivator pageActivator,
            HtmlEncoder htmlEncoder,
            IOptions<RazorViewEngineOptions> optionsAccessor,
            ILoggerFactory loggerFactory)
        {
            _options = optionsAccessor.Value;

            if (_options.ViewLocationFormats.Count == 0)
            {
                throw new ArgumentException(
                    Resources.FormatViewLocationFormatsIsRequired(nameof(RazorViewEngineOptions.ViewLocationFormats)),
                    nameof(optionsAccessor));
            }

            if (_options.AreaViewLocationFormats.Count == 0)
            {
                throw new ArgumentException(
                    Resources.FormatViewLocationFormatsIsRequired(nameof(RazorViewEngineOptions.AreaViewLocationFormats)),
                    nameof(optionsAccessor));
            }

            _pageFactory = pageFactory;
            _pageActivator = pageActivator;
            _htmlEncoder = htmlEncoder;
            _logger = loggerFactory.CreateLogger<RazorViewEngine>();
            ViewLookupCache = new MemoryCache(new MemoryCacheOptions
            {
                CompactOnMemoryPressure = false
            });
        }
开发者ID:ymd1223,项目名称:Mvc,代码行数:35,代码来源:RazorViewEngine.cs


注:本文中的ILogger类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。