예제 #1
0
    public HelperResult LogRow(LogInfo log)
    {
        return new HelperResult((writer) =>
        {
            if (log.Severity >= Model.Options.MinLevel &&
               (string.IsNullOrEmpty(Model.Options.NamePrefix) || log.Name.StartsWith(Model.Options.NamePrefix, StringComparison.Ordinal)))
            {
                WriteLiteralTo(writer, "        <tr>\r\n            <td>");
                WriteTo(writer, string.Format("{0:MM/dd/yy}", log.Time));
                WriteLiteralTo(writer, "</td>\r\n            <td>");
                WriteTo(writer, string.Format("{0:H:mm:ss}", log.Time));
                var severity = log.Severity.ToString().ToLowerInvariant();
                WriteLiteralTo(writer, $"</td>\r\n            <td class=\"{severity}\">");
                WriteTo(writer, log.Severity);

                WriteLiteralTo(writer, $"</td>\r\n            <td title=\"{log.Name}\">");
                WriteTo(writer, log.Name);

                WriteLiteralTo(writer, $"</td>\r\n            <td title=\"{log.Message}\""+
                    "class=\"logState\" width=\"100px\">");
                WriteTo(writer, log.Message);

                WriteLiteralTo(writer, $"</td>\r\n            <td title=\"{log.Exception}\">");
                WriteTo(writer, log.Exception);

                WriteLiteralTo(writer, "</td>\r\n        </tr>\r\n");
            }
        });
    }
예제 #2
0
 public void Log(LogLevel logLevel, int eventId, object state, Exception exception, 
                   Func<object, Exception, string> formatter)
 {
     if (!IsEnabled(logLevel) || (state == null && exception == null))
     {
         return;
     }
     LogInfo info = new LogInfo()
     {
         ActivityContext = GetCurrentActivityContext(),
         Name = _name,
         EventID = eventId,
         Severity = logLevel,
         Exception = exception,
         State = state,
         Message = formatter == null ? state.ToString() : formatter(state, exception),
         Time = DateTimeOffset.UtcNow
     };
     if (ElmScope.Current != null)
     {
         ElmScope.Current.Node.Messages.Add(info);
     }
     // The log does not belong to any scope - create a new context for it
     else
     {
         var context = GetNewActivityContext();
         context.RepresentsScope = false;  // mark as a non-scope log
         context.Root = new ScopeNode();
         context.Root.Messages.Add(info);
         _store.AddActivity(context);
     }
 }
 private LogInfoDto GetLogInfoDto(LogInfo logInfo)
 {
     return new LogInfoDto()
     {
         EventID = logInfo.EventID,
         Exception = logInfo.Exception,
         LoggerName = logInfo.Name,
         LogLevel = logInfo.Severity,
         State = logInfo.State,
         StateType = logInfo.State?.GetType()
     };
 }
예제 #4
0
LogRow(LogInfo log, int level) {

#line default
#line hidden
        return new HelperResult((__razor_helper_writer) => {
#line 21 "LogPage.cshtml"
                                        
    if (log.Severity >= Model.Options.MinLevel && 
        (string.IsNullOrEmpty(Model.Options.NamePrefix) || log.Name.StartsWith(Model.Options.NamePrefix, StringComparison.Ordinal)))
    {

#line default
#line hidden

            WriteLiteralTo(__razor_helper_writer, "        <tr class=\"logRow\">\r\n            <td>");
#line 26 "LogPage.cshtml"
WriteTo(__razor_helper_writer, string.Format("{0:MM/dd/yy}", log.Time));

#line default
#line hidden
            WriteLiteralTo(__razor_helper_writer, "</td>\r\n            <td>");
#line 27 "LogPage.cshtml"
WriteTo(__razor_helper_writer, string.Format("{0:H:mm:ss}", log.Time));

#line default
#line hidden
            WriteLiteralTo(__razor_helper_writer, "</td>\r\n            <td");
            WriteAttributeTo(__razor_helper_writer, "title", Tuple.Create(" title=\"", 871), Tuple.Create("\"", 888), 
            Tuple.Create(Tuple.Create("", 879), Tuple.Create<System.Object, System.Int32>(log.Name, 879), false));
            WriteLiteralTo(__razor_helper_writer, ">");
#line 28 "LogPage.cshtml"
    WriteTo(__razor_helper_writer, log.Name);

#line default
#line hidden
            WriteLiteralTo(__razor_helper_writer, "</td>\r\n            <td");
            WriteAttributeTo(__razor_helper_writer, "class", Tuple.Create(" class=\"", 921), Tuple.Create("\"", 972), 
            Tuple.Create(Tuple.Create("", 929), Tuple.Create<System.Object, System.Int32>(log.Severity.ToString().ToLowerInvariant(), 929), false));
            WriteLiteralTo(__razor_helper_writer, ">");
#line 29 "LogPage.cshtml"
                                      WriteTo(__razor_helper_writer, log.Severity);

#line default
#line hidden
            WriteLiteralTo(__razor_helper_writer, "</td>\r\n            <td");
            WriteAttributeTo(__razor_helper_writer, "title", Tuple.Create(" title=\"", 1009), Tuple.Create("\"", 1029), 
            Tuple.Create(Tuple.Create("", 1017), Tuple.Create<System.Object, System.Int32>(log.Message, 1017), false));
            WriteLiteralTo(__razor_helper_writer, ">\r\n");
#line 31 "LogPage.cshtml"
                

#line default
#line hidden

#line 31 "LogPage.cshtml"
                 for (var i = 0; i < level; i++)
                {

#line default
#line hidden

            WriteLiteralTo(__razor_helper_writer, "                    <span class=\"tab\"></span>\r\n");
#line 34 "LogPage.cshtml"
                }

#line default
#line hidden

            WriteLiteralTo(__razor_helper_writer, "                ");
#line 35 "LogPage.cshtml"
WriteTo(__razor_helper_writer, log.Message);

#line default
#line hidden
            WriteLiteralTo(__razor_helper_writer, "\r\n            </td>\r\n            <td");
            WriteAttributeTo(__razor_helper_writer, "title", Tuple.Create(" title=\"", 1232), Tuple.Create("\"", 1254), 
            Tuple.Create(Tuple.Create("", 1240), Tuple.Create<System.Object, System.Int32>(log.Exception, 1240), false));
            WriteLiteralTo(__razor_helper_writer, ">");
#line 37 "LogPage.cshtml"
         WriteTo(__razor_helper_writer, log.Exception);

#line default
#line hidden
            WriteLiteralTo(__razor_helper_writer, "</td>\r\n        </tr>\r\n");
#line 39 "LogPage.cshtml"
    }

#line default
#line hidden

        }
        );
#line 40 "LogPage.cshtml"
}
예제 #5
0
LogRow(LogInfo log)
{

#line default
#line hidden
        return new HelperResult((__razor_helper_writer) => {
#line 20 "DetailsPage.cshtml"
 
    if (log.Severity >= Model.Options.MinLevel &&
        (string.IsNullOrEmpty(Model.Options.NamePrefix) || log.Name.StartsWith(Model.Options.NamePrefix, StringComparison.Ordinal)))
    {

#line default
#line hidden

            WriteLiteralTo(__razor_helper_writer, "        <tr>\r\n            <td>");
#line 25 "DetailsPage.cshtml"
WriteTo(__razor_helper_writer, string.Format("{0:MM/dd/yy}", log.Time));

#line default
#line hidden
            WriteLiteralTo(__razor_helper_writer, "</td>\r\n            <td>");
#line 26 "DetailsPage.cshtml"
WriteTo(__razor_helper_writer, string.Format("{0:H:mm:ss}", log.Time));

#line default
#line hidden
            WriteLiteralTo(__razor_helper_writer, "</td>\r\n            <td");
            WriteAttributeTo(__razor_helper_writer, "class", Tuple.Create(" class=\"", 768), Tuple.Create("\"", 819), 
            Tuple.Create(Tuple.Create("", 776), Tuple.Create<System.Object, System.Int32>(log.Severity.ToString().ToLowerInvariant(), 776), false));
            WriteLiteralTo(__razor_helper_writer, ">");
#line 27 "DetailsPage.cshtml"
                                      WriteTo(__razor_helper_writer, log.Severity);

#line default
#line hidden
            WriteLiteralTo(__razor_helper_writer, "</td>\r\n            <td");
            WriteAttributeTo(__razor_helper_writer, "title", Tuple.Create(" title=\"", 856), Tuple.Create("\"", 873), 
            Tuple.Create(Tuple.Create("", 864), Tuple.Create<System.Object, System.Int32>(log.Name, 864), false));
            WriteLiteralTo(__razor_helper_writer, ">");
#line 28 "DetailsPage.cshtml"
    WriteTo(__razor_helper_writer, log.Name);

#line default
#line hidden
            WriteLiteralTo(__razor_helper_writer, "</td>\r\n            <td");
            WriteAttributeTo(__razor_helper_writer, "title", Tuple.Create(" title=\"", 906), Tuple.Create("\"", 926), 
            Tuple.Create(Tuple.Create("", 914), Tuple.Create<System.Object, System.Int32>(log.Message, 914), false));
            WriteLiteralTo(__razor_helper_writer, " class=\"logState\" width=\"100px\">");
#line 29 "DetailsPage.cshtml"
                                      WriteTo(__razor_helper_writer, log.Message);

#line default
#line hidden
            WriteLiteralTo(__razor_helper_writer, "</td>\r\n            <td");
            WriteAttributeTo(__razor_helper_writer, "title", Tuple.Create(" title=\"", 993), Tuple.Create("\"", 1015), 
            Tuple.Create(Tuple.Create("", 1001), Tuple.Create<System.Object, System.Int32>(log.Exception, 1001), false));
            WriteLiteralTo(__razor_helper_writer, ">");
#line 30 "DetailsPage.cshtml"
         WriteTo(__razor_helper_writer, log.Exception);

#line default
#line hidden
            WriteLiteralTo(__razor_helper_writer, "</td>\r\n        </tr>\r\n");
#line 32 "DetailsPage.cshtml"
    }

#line default
#line hidden

        }
        );
#line 33 "DetailsPage.cshtml"
}