本文整理汇总了C#中ILoggerFactory.Create方法的典型用法代码示例。如果您正苦于以下问题:C# ILoggerFactory.Create方法的具体用法?C# ILoggerFactory.Create怎么用?C# ILoggerFactory.Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILoggerFactory
的用法示例。
在下文中一共展示了ILoggerFactory.Create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessInstance
public ProcessInstance(ILoggerFactory loggerFactory, ProcessDefinition definition)
{
Definition = definition;
Log = loggerFactory.Create(GetType());
Output = loggerFactory.Create("Process." + definition.Name);
Exited = _tcs.Task;
}
示例2: DefaultAgent
/// <summary>
/// 初始化agent
/// </summary>
/// <param name="factory"></param>
/// <param name="master">指定master server,若为空则忽略</param>
/// <param name="name">agent节点名</param>
/// <param name="description">agent节点描述</param>
/// <param name="handle"></param>
public DefaultAgent(ILoggerFactory factory
, string master
, string name
, string description
, IMessageHandle handle)
: this(factory.Create(typeof(DefaultAgent))
, master, name, description, handle)
{
this._log = factory.Create(this.GetType());
}
示例3: LoggersManager
public LoggersManager(ILoggerFactory fac, LoggerLevel level)
{
_level = level;
_factory = fac;
_appLogger = new Lazy<ILogger>(() => _factory.Create("Application", _level));
_webServerLogger = new Lazy<ILogger>(() => _factory.Create("WebServer", _level));
_dataLogger = new Lazy<ILogger>(() => _factory.Create("DAL", _level));
_handlersLogger = new Lazy<ILogger>(() => _factory.Create("Handler", _level));
}
示例4: RunLogDemo
public void RunLogDemo()
{
Log4netConfigurator.TurnAppender(Appenders.Console, OnOff.On, true);
Logger = Aspects.GetLogger(); EchoLogDescription(Logger);
Logger.Info("Logger from the provider.");
LoggerFactory = new Log4netLoggerFactory();
Logger = LoggerFactory.Create(typeof(King)); EchoLogDescription(Logger);
Logger.Info("Logger direct from the factory.");
Logger = LoggerFactory.Create("MyLogger"); EchoLogDescription(Logger);
Logger.Info("Logger from IoC/DI.");
}
示例5: IdentityServerBearerTokenValidationMiddleware
/// <summary>
/// Initializes a new instance of the <see cref="IdentityServerBearerTokenValidationMiddleware" /> class.
/// </summary>
/// <param name="next">The next middleware.</param>
/// <param name="options">The options.</param>
/// <param name="loggerFactory">The logger factory.</param>
public IdentityServerBearerTokenValidationMiddleware(AppFunc next, IdentityServerOAuthBearerAuthenticationOptions options, ILoggerFactory loggerFactory)
{
_next = next;
_options = options;
_logger = loggerFactory.Create(this.GetType().FullName);
if (options.LocalValidationOptions != null)
{
var localBuilder = new AppBuilder();
options.OnValidationAppBuilderCreated?.Invoke(localBuilder);
localBuilder.UseOAuthBearerAuthentication(options.LocalValidationOptions);
localBuilder.Run(ctx => next(ctx.Environment));
_localValidationFunc = localBuilder.Build();
}
if (options.EndpointValidationOptions != null)
{
var endpointBuilder = new AppBuilder();
options.OnValidationAppBuilderCreated?.Invoke(endpointBuilder);
endpointBuilder.Properties["host.AppName"] = "foobar";
endpointBuilder.UseOAuthBearerAuthentication(options.EndpointValidationOptions);
endpointBuilder.Run(ctx => next(ctx.Environment));
_endpointValidationFunc = endpointBuilder.Build();
}
}
开发者ID:fryderykhuang,项目名称:IdentityServer3.AccessTokenValidation,代码行数:32,代码来源:IdentityServerBearerTokenValidationMiddleware.cs
示例6: IISManager
public IISManager(string localSitesPath, string tempSitesPath, ISyncStatusRepository syncStatusRepository, ILoggerFactory loggerFactory, LoggerLevel logLevel)
{
_syncStatusRepository = syncStatusRepository;
_localSitesPath = localSitesPath;
_tempSitesPath = tempSitesPath;
_logger = loggerFactory.Create(GetType(), logLevel);
}
示例7: ValidationEndpointTokenProvider
public ValidationEndpointTokenProvider(IdentityServerBearerTokenAuthenticationOptions options, ILoggerFactory loggerFactory)
{
_logger = loggerFactory.Create("ValidationEndpointTokenProvider");
var baseAddress = options.Authority.EnsureTrailingSlash();
baseAddress += "connect/accesstokenvalidation";
_tokenValidationEndpoint = baseAddress;
var handler = options.BackchannelHttpHandler ?? new WebRequestHandler();
if (options.BackchannelCertificateValidator != null)
{
// Set the cert validate callback
var webRequestHandler = handler as WebRequestHandler;
if (webRequestHandler == null)
{
throw new InvalidOperationException("Invalid certificate validator");
}
webRequestHandler.ServerCertificateValidationCallback = options.BackchannelCertificateValidator.Validate;
}
_client = new HttpClient(handler);
_options = options;
}
开发者ID:billpratt,项目名称:IdentityServer3.AccessTokenValidation,代码行数:25,代码来源:ValidationEndpointTokenProvider.cs
示例8: NHibernateContextTransactionManager
public NHibernateContextTransactionManager(ISessionFactory sessionFactory, IContextTransactionLifetimeManager contextTransactionLifetimeManager, ILoggerFactory loggerFactory)
{
_sessionFactory = sessionFactory;
_contextTransactionLifetimeManager = contextTransactionLifetimeManager;
_loggerFactory = loggerFactory;
_logger = loggerFactory.Create("EventSourcing.NHibernateContextTransactionManager");
}
示例9: DefaultCommandExecutor
public DefaultCommandExecutor(
IProcessingCommandCache processingCommandCache,
ICommandAsyncResultManager commandAsyncResultManager,
ICommandHandlerProvider commandHandlerProvider,
IAggregateRootTypeProvider aggregateRootTypeProvider,
IMemoryCache memoryCache,
IRepository repository,
IRetryCommandService retryCommandService,
IEventStore eventStore,
IEventPublisher eventPublisher,
IEventPersistenceSynchronizerProvider eventPersistenceSynchronizerProvider,
ICommandContext commandContext,
ILoggerFactory loggerFactory)
{
_processingCommandCache = processingCommandCache;
_commandAsyncResultManager = commandAsyncResultManager;
_commandHandlerProvider = commandHandlerProvider;
_aggregateRootTypeProvider = aggregateRootTypeProvider;
_memoryCache = memoryCache;
_repository = repository;
_retryCommandService = retryCommandService;
_eventStore = eventStore;
_eventPublisher = eventPublisher;
_eventPersistenceSynchronizerProvider = eventPersistenceSynchronizerProvider;
_commandContext = commandContext;
_trackingContext = commandContext as ITrackingContext;
_logger = loggerFactory.Create(GetType().Name);
if (_trackingContext == null)
{
throw new Exception("command context must also implement ITrackingContext interface.");
}
}
示例10: WebFarmRole
/// <summary>
/// Instantiates an Azure Web Farm Role.
/// </summary>
/// <param name="logFactory">The Castle.Core Logger Factory to use for logging, AzureDiagnosticsTraceListenerFactory by default</param>
/// <param name="loggerLevel">The Castle.Core Log Level to use for logging, LoggerLevel.Info by default</param>
/// <param name="diagnosticsLogLevel">The log level to use for Azure Diagnostics, LogLevel.Information by default</param>
public WebFarmRole(ILoggerFactory logFactory = null, LoggerLevel? loggerLevel = null, LogLevel? diagnosticsLogLevel = null)
{
_logFactory = logFactory ?? new AzureDiagnosticsTraceListenerFactory();
_logLevel = loggerLevel ?? LoggerLevel.Info;
_logger = _logFactory.Create(GetType(), _logLevel);
_diagnosticsLogLevel = diagnosticsLogLevel ?? LogLevel.Information;
}
示例11: DefaultEventProcessor
/// <summary>Parameterized constructor.
/// </summary>
/// <param name="eventHandlerTypeCodeProvider"></param>
/// <param name="eventHandlerProvider"></param>
/// <param name="eventPublishInfoStore"></param>
/// <param name="eventHandleInfoStore"></param>
/// <param name="eventHandleInfoCache"></param>
/// <param name="actionExecutionService"></param>
/// <param name="loggerFactory"></param>
public DefaultEventProcessor(
IEventHandlerTypeCodeProvider eventHandlerTypeCodeProvider,
IEventHandlerProvider eventHandlerProvider,
IEventPublishInfoStore eventPublishInfoStore,
IEventHandleInfoStore eventHandleInfoStore,
IEventHandleInfoCache eventHandleInfoCache,
IActionExecutionService actionExecutionService,
ILoggerFactory loggerFactory)
{
_eventHandlerTypeCodeProvider = eventHandlerTypeCodeProvider;
_eventHandlerProvider = eventHandlerProvider;
_eventPublishInfoStore = eventPublishInfoStore;
_eventHandleInfoStore = eventHandleInfoStore;
_eventHandleInfoCache = eventHandleInfoCache;
_actionExecutionService = actionExecutionService;
_logger = loggerFactory.Create(GetType().Name);
_queueList = new List<BlockingCollection<EventProcessingContext>>();
for (var index = 0; index < WorkerCount; index++)
{
_queueList.Add(new BlockingCollection<EventProcessingContext>(new ConcurrentQueue<EventProcessingContext>()));
}
_workerList = new List<Worker>();
for (var index = 0; index < WorkerCount; index++)
{
var queue = _queueList[index];
var worker = new Worker(() =>
{
DispatchEventsToHandlers(queue.Take());
});
_workerList.Add(worker);
worker.Start();
}
}
示例12: Initialize
public void Initialize(string username, string[] servers, ILoggerFactory loggerFactory = null, string authToken = null)
{
_loggerFactory = loggerFactory ?? new DebugLoggerFactory();
_log = _loggerFactory.Create(typeof(ReactiveTrader));
_connectionProvider = new ConnectionProvider(username, servers, _loggerFactory);
var referenceDataServiceClient = new ReferenceDataServiceClient(_connectionProvider, _loggerFactory);
var executionServiceClient = new ExecutionServiceClient(_connectionProvider);
var blotterServiceClient = new BlotterServiceClient(_connectionProvider, _loggerFactory);
var pricingServiceClient = new PricingServiceClient(_connectionProvider, _loggerFactory);
PricingServiceClient = pricingServiceClient;
if (authToken != null)
{
var controlServiceClient = new ControlServiceClient(new AuthTokenProvider(authToken), _connectionProvider, _loggerFactory);
_controlRepository = new ControlRepository(controlServiceClient);
}
PriceLatencyRecorder = new PriceLatencyRecorder();
var concurrencyService = new ConcurrencyService();
var tradeFactory = new TradeFactory();
var executionRepository = new ExecutionRepository(executionServiceClient, tradeFactory, concurrencyService);
var priceFactory = new PriceFactory(executionRepository, PriceLatencyRecorder);
var priceRepository = new PriceRepository(pricingServiceClient, priceFactory, _loggerFactory);
var currencyPairUpdateFactory = new CurrencyPairUpdateFactory(priceRepository);
TradeRepository = new TradeRepository(blotterServiceClient, tradeFactory);
ReferenceData = new ReferenceDataRepository(referenceDataServiceClient, currencyPairUpdateFactory);
}
示例13: IdentityServerBearerTokenValidationMiddleware
/// <summary>
/// Initializes a new instance of the <see cref="IdentityServerBearerTokenValidationMiddleware" /> class.
/// </summary>
/// <param name="next">The next middleware.</param>
/// <param name="app">The app builder.</param>
/// <param name="options">The options.</param>
/// <param name="loggerFactory">The logger factory.</param>
public IdentityServerBearerTokenValidationMiddleware(AppFunc next, IAppBuilder app, IdentityServerOAuthBearerAuthenticationOptions options, ILoggerFactory loggerFactory)
{
_next = next;
_options = options;
_logger = loggerFactory.Create(this.GetType().FullName);
if (options.LocalValidationOptions != null)
{
_localValidationFunc = new Lazy<AppFunc>(() =>
{
var localBuilder = app.New();
localBuilder.UseOAuthBearerAuthentication(options.LocalValidationOptions.Value);
localBuilder.Run(ctx => next(ctx.Environment));
return localBuilder.Build();
}, true);
}
if (options.EndpointValidationOptions != null)
{
_endpointValidationFunc = new Lazy<AppFunc>(() =>
{
var endpointBuilder = app.New();
endpointBuilder.Properties["host.AppName"] = "foobar";
endpointBuilder.UseOAuthBearerAuthentication(options.EndpointValidationOptions.Value);
endpointBuilder.Run(ctx => next(ctx.Environment));
return endpointBuilder.Build();
}, true);
}
}
开发者ID:NetChris,项目名称:IdentityServer3.AccessTokenValidation,代码行数:39,代码来源:IdentityServerBearerTokenValidationMiddleware.cs
示例14: SpotTilePricingViewModel
public SpotTilePricingViewModel(ICurrencyPair currencyPair, SpotTileSubscriptionMode spotTileSubscriptionMode, ISpotTileViewModel parent,
Func<Direction, ISpotTilePricingViewModel, IOneWayPriceViewModel> oneWayPriceFactory,
IReactiveTrader reactiveTrader,
IConcurrencyService concurrencyService,
IConstantRatePump constantRatePump,
ILoggerFactory loggerFactory)
{
_currencyPair = currencyPair;
_subscriptionMode = spotTileSubscriptionMode;
_parent = parent;
_priceLatencyRecorder = reactiveTrader.PriceLatencyRecorder;
_concurrencyService = concurrencyService;
_constantRatePump = constantRatePump;
_log = loggerFactory.Create(typeof(SpotTilePricingViewModel));
_priceSubscription = new SerialDisposable();
Bid = oneWayPriceFactory(Direction.SELL, this);
Ask = oneWayPriceFactory(Direction.BUY, this);
Notional = "1000000";
DealtCurrency = currencyPair.BaseCurrency;
SpotDate = "SP";
IsSubscribing = true;
SubscribeForPrices();
}
示例15: DefaultEventService
public DefaultEventService(
IJsonSerializer jsonSerializer,
IScheduleService scheduleService,
ITypeNameProvider typeNameProvider,
IMemoryCache memoryCache,
IAggregateRootFactory aggregateRootFactory,
IAggregateStorage aggregateStorage,
IEventStore eventStore,
IMessagePublisher<DomainEventStreamMessage> domainEventPublisher,
IOHelper ioHelper,
ILoggerFactory loggerFactory)
{
_eventMailboxDict = new ConcurrentDictionary<string, EventMailBox>();
_ioHelper = ioHelper;
_jsonSerializer = jsonSerializer;
_scheduleService = scheduleService;
_typeNameProvider = typeNameProvider;
_memoryCache = memoryCache;
_aggregateRootFactory = aggregateRootFactory;
_aggregateStorage = aggregateStorage;
_eventStore = eventStore;
_domainEventPublisher = domainEventPublisher;
_logger = loggerFactory.Create(GetType().FullName);
_batchSize = ENodeConfiguration.Instance.Setting.EventMailBoxPersistenceMaxBatchSize;
}