本文整理汇总了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);
}
示例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;
}
示例3: WebApplicationComponent
//-----------------------------------------------------------------------------------------------------------------------------------------------------
public WebApplicationComponent(IWebAppEndpoint endpoint, Auto<ILogger> logger, IComponentContext componentContext)
{
_app = endpoint.Contract;
_address = endpoint.Address;
_logger = logger.Instance;
_container = (ILifetimeScope)componentContext;
}
示例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)
);
}
}
示例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();
}
示例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;
}
示例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;
}
示例8: SerializationProcessor
public SerializationProcessor(string signKeyFile, List<string> references, List<AssemblyDefinition> memoryReferences, ILogger log)
{
SignKeyFile = signKeyFile;
References = references;
MemoryReferences = memoryReferences;
Log = log;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例13: SqsQueueDynamoDbCircuitBreaker
public SqsQueueDynamoDbCircuitBreaker(IAmazonSQS queueClient, string queueName, int breakerTripQueueSize, ILogger structuredLogger)
{
this.structuredLogger = structuredLogger;
this.breakerTripQueueSize = breakerTripQueueSize;
this.queueClient = queueClient;
this.queueName = queueName;
}
示例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();
}
示例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
});
}