Ejemplo n.º 1
0
        public async Task <ActionResult <string> > Get()
        {
            try
            {
                _logger.Log(new LogEnrtyEx(LogLevel.Warning, "Request")
                {
                    Http = new HttpInfo
                    {
                        Request = await HttpRequestInfo.CreateAsync(HttpContext)
                    }
                });

                _logger.Entry.Extend("myMessage", "Hi");
                _logger.Entry.Extend("message", "Hi________________");
                _logger.Entry.Extend("request", await HttpRequestInfo.CreateAsync(HttpContext));
                _logger.FlushEntry();

                LogEnrtyEx ent = new LogEnrtyEx(LogLevel.Information, "gollaa");
                ent.Category = "ddddddddd";
                _logger.Log(LogLevel.Information, ent);

                _logger.LogInformation("Test");

                throw new ApplicationException("wow");
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, ex.Message);
                return(BadRequest(ex.Message));
            }
        }