public static void RegisterGlobalFilters(GlobalFilterCollection filters) { filters.Add(new HandleErrorAttribute()); IPerformanceLogger performanceLogger = null; IApplicationConfiguration applicationConfiguration = null; try { performanceLogger = DependencyResolver.Current.GetService <IPerformanceLogger>(); applicationConfiguration = DependencyResolver.Current.GetService <IApplicationConfiguration>(); if (performanceLogger == null || !performanceLogger.IsPerformanceLogEnabled()) { return; } var performanceLogProvider = DependencyResolver.Current.GetService <IPerformanceLogProvider>(); if (performanceLogProvider == null) { return; } var performanceLogActionFilter = new PerformanceLogActionFilter(performanceLogProvider, applicationConfiguration); filters.Add(performanceLogActionFilter); } catch (Exception) { // swallow up, non critical functionality } }
/// <summary> /// Creates a new instance of the processor class. /// </summary> /// <param name="logger">The logger to use.</param> /// <param name="performanceLogger">The performance logger to use.</param> /// <param name="cm">The config that will be used.</param> public Processor(ILogger logger, IPerformanceLogger performanceLogger, ConfigManager cm) { Logger = logger; PerformanceLogger = performanceLogger; Config = cm; OutputHandler = null; }
public AnalysisMiddleware(RequestDelegate next, string middlewareName, IPerformanceLogger <AnalysisMiddleware> performanceLogger) { _next = next; if (string.IsNullOrEmpty(middlewareName)) { middlewareName = next.Target.GetType().FullName; } _middlewareName = middlewareName; _performanceLogger = performanceLogger; }
public void GlobalSetup() { // Configure logger factory. var loggerFactory = LoggerFactory.Create(builder => builder.SetMinimumLevel(MinimumLogLevel)); loggerFactory.AddLogger(); // Create logger. _logger = loggerFactory.CreateLogger <TraceLogging>(); _wrappedLogger = _logger.Wrap(); }
/// <summary> /// Loads the performance logger, based on the used platform. /// </summary> void LoadPerformanceLogger() { switch (Environment.OSVersion.Platform) { case PlatformID.Win32NT: PerformanceLogger = new WindowsPerformanceCounters(); break; default: PerformanceLogger = NullPerformanceLogger.Instance; break; } }
private PerformanceProfiler(IPerformanceLogger logger, IPerformanceMarkerIdGenerator idGenerator) { if (logger == null) { throw new ArgumentNullException("logger"); } if (idGenerator == null) { throw new ArgumentNullException("idGenerator"); } _logger = logger; _idGenerator = idGenerator; }
public PerformanceLoggerService(IOptionsMonitor <PerformanceLoggerServiceOptions> optionsMonitor) { var options = optionsMonitor.CurrentValue; switch (options?.LoggerType?.ToLower()) { case "azuretable": _resourceLogger = new AzureTablePerformanceLogger(); Console.WriteLine("Added AzureTable resource logger"); break; } if (_resourceLogger != null) { _resourceLogger.Init(options.ConnectionString); } }
public PerformanceLoggingDecoratorFactory(IPerformanceLogger logger) { _logger = logger; }
public HomeController(IPerformanceLogger <HomeController> performanceLogger) { _performanceLogger = performanceLogger; }
public PerformanceLoggerSelector(IPerformanceLogger logger) { _logger = logger; }
public ServiceA(IPerformanceLogger perfLogger) { _perfLogger = perfLogger; }
public PerformanceLoggingDecoratorTest() { _logger = new PerformanceLoggerBuilder(new NullLoggerFactory()).Build(); }
public PerformanceBehavior(IPerformanceLogger performanceLogger) { this.performanceLogger = performanceLogger; stopwatch = new Stopwatch(); }
/// <summary> /// Initializes PerformanceAggregateLogger with a inner logger. /// </summary> /// <param name="fineGrainLogger">This inner logger "Log" will be called when calling this.Log </param> public PerformanceAggregateLogger(IPerformanceLogger fineGrainLogger) { _logger = fineGrainLogger; }
public CallTimer(string contractName, bool isClient) { _contractName = contractName; _isClient = isClient; _log = new PerformanceLogger <WcfPerformanceData>("WcfExecutionTime"); }