Exemple #1
0
 public HttpLogger(string name, LogMiddleware logMiddleware, IOptionsMonitor <HttpLoggerOptions> options, IHttpContextAccessor contextAccessor)
 {
     _logMiddleware   = logMiddleware;
     _name            = name;
     _contextAccessor = contextAccessor;
     Options          = options;
 }
Exemple #2
0
        public HttpLoggerProcessor(LogMiddleware middleware, HttpContext context)
        {
            _middleware = middleware;

            // HttpLogger Key Cookie
            if (context.Request.Cookies.ContainsKey("HttpLogger"))
            {
                _myHttpLoggerKey = context.Request.Cookies["HttpLogger"];
            }
            else
            {
                _myHttpLoggerKey = Guid.NewGuid().ToString();
                context.Response.Cookies.Append("HttpLogger", _myHttpLoggerKey);
            }

            // Start writer
            _writer           = new StreamWriter(context.Response.Body);
            _writer.AutoFlush = true;
            _writer.WriteLine("<header><style>body{background:#000;color:#fff;line-height:14px;font-size:12px;font-family:'Lucida Console', Monaco, monospace}</style></header>");

            InitializeQuery(context.Request.Query);
        }
Exemple #3
0
        public HttpLoggerProcessor(LogMiddleware middleware, HttpContext context)
        {
            _middleware = middleware;

            // HttpLogger Key Cookie
            if (context.Request.Cookies.ContainsKey("HttpLogger"))
            {
                _myHttpLoggerKey = context.Request.Cookies["HttpLogger"];
            }
            else
            {
                _myHttpLoggerKey = Guid.NewGuid().ToString();
                context.Response.Cookies.Append("HttpLogger", _myHttpLoggerKey);
            }

            // Start writer
            _writer = new StreamWriter(context.Response.Body);
            WriteLineAsync("<header>" +
                           "<style>body{background:#000;color:#fff;line-height:14px;font-size:12px;font-family:'Lucida Console', Monaco, monospace}</style>" +
                           "</header><body>" +
                           "<script>var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;var observer = new MutationObserver(function (mutations, observer) { window.scrollTo(0, window.document.body.scrollHeight);});observer.observe(document, { subtree: true, attributes: true, childList: true, characterData: true});</script>");

            InitializeQuery(context.Request.Query);
        }
Exemple #4
0
 public HttpLoggerProvider(LogMiddleware logMiddleware, IHttpContextAccessor contextAccessor)
 {
     _logMiddleware   = logMiddleware;
     _contextAccessor = contextAccessor;
 }