Ejemplo n.º 1
0
        public async Task Invoke(HttpContext context)
        {
            //var watch = new Stopwatch();
            //watch.Start();
            _logger.Log("Hallo");
            await _next(context);

            //context.Response.Headers.Add("X-Processing-Time-Milliseconds", new[] { watch.ElapsedMilliseconds.ToString() });
        }
Ejemplo n.º 2
0
        public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter)
        {
            if (exception != null)
            {
                return;
            }

            LogType lt = LogType.Information;

            switch (logLevel)
            {
            case LogLevel.Trace:
                lt = LogType.Debug;
                break;

            case LogLevel.Debug:
                lt = LogType.Debug;
                break;

            case LogLevel.Information:
                lt = LogType.Information;
                break;

            case LogLevel.Warning:
                lt = LogType.Warnig;
                break;

            case LogLevel.Error:
                Debug.WriteLine("HIER FEHLT ETWAS!!! LoggerWrapper.Log");
                break;

            case LogLevel.Critical:
                Debug.WriteLine("HIER FEHLT ETWAS!!! LoggerWrapper.Log");
                break;

            case LogLevel.None:
                lt = LogType.Information;
                break;
            }

            _logger.Log(state.ToString(), lt);
        }
Ejemplo n.º 3
0
        public HomeController(ILoggerService loggerService)
        {
            _logger = loggerService.CreateLogger <HomeController>();

            _logger.Log("HomeController");
        }