Ejemplo n.º 1
0
        public virtual string GetLogFormat(LoggingFormatterParams @params, LogAttribute attribute)
        {
            var builder = new StringBuilder();

            foreach (var formatter in formatters.Where(x => x.IsSatisfiedBy(attribute)))
            {
                builder.Append(formatter.Format(@params));
            }

            return(builder.ToString());
        }
Ejemplo n.º 2
0
 private static void LogDetails(Action <string, Exception> logTarget, LogAttribute attribute, LoggingFormatterParams @params)
 {
     if (attribute.Formatter != null)
     {
         var logFormat = attribute.Formatter.GetLogFormat(@params, attribute);
         logTarget(logFormat.Take(4096).Aggregate("", (input, next) => input += next), null);
     }
     else
     {
         logTarget(@params.Invocation.MethodInvocationTarget.Name, @params.Exception);
     }
 }