示例#1
0
 /// <summary>
 /// Logs properties. The dump must be an anonymous type with at least one property: new { foo[, bar] }
 /// </summary>
 public static IAbstractionContext Property(this IAbstractionLayer layer, object snapshot)
 {
     return
         (layer
          .SetItem(AbstractionProperties.Category, nameof(Property))
          .SetItem(AbstractionProperties.Snapshot, snapshot));
 }
示例#2
0
 /// <summary>
 /// Initializes Routine category.
 /// </summary>
 public static IAbstractionCategory Routine(this IAbstractionLayer layer, string identifier)
 {
     return
         (layer
          .SetItem(AbstractionProperties.Category, nameof(Routine))
          .SetItem(AbstractionProperties.Identifier, identifier));
 }
示例#3
0
 public static IAbstractionContext Decision(this IAbstractionLayer layer, object description)
 {
     return
         (layer
          .SetItem(AbstractionProperties.Category, "Flow")
          .SetItem(AbstractionProperties.Snapshot, new { Decision = description }));
 }
示例#4
0
        public static IAbstractionCategory RoutineFromScope(this IAbstractionLayer layer)
        {
            if (LogScope.Current is null)
            {
                return(layer.Routine($"#'{nameof(RoutineFromScope)}' used outside of a scope."));
            }

            // Try to find routine-identifier in the scope hierarchy.
            var scope =
                LogScope
                .Current
                .Flatten()
                .FirstOrDefault(s => s.ContainsKey(nameof(Routine)));

            return
                (scope is null
                    ? layer.Routine("#Scope does not contain routine identifier.")
                    : layer.Routine((string)scope[nameof(Routine)]));
        }
 public AbstractionLayerCategory(IAbstractionLayer layer, [CallerMemberName] string name = null)
 {
     Layer = layer;
     Name  = name;
 }
 /// <summary>
 /// Logs performance counters. The dump must be an anonymous type with at leas one property: new { foo[, bar] }
 /// </summary>
 public static IAbstractionContext Counter(this IAbstractionLayer layer, object dump) => new AbstractionContext(layer, dump);
 public static IAbstractionLayerRoutine Routine(this IAbstractionLayer layer, string identifier) => new AbstractionLayerRoutine(layer, identifier);
 /// <summary>
 /// Logs arguments. The dump must be an anonymous type with at leas one property: new { foo[, bar] }
 /// </summary>
 public static IAbstractionContext Argument(this IAbstractionLayer layer, object dump) => new AbstractionContext(layer, dump);
 /// <summary>
 /// Logs properties. The dump must be an anonymous type with at least one property: new { foo[, bar] }
 /// </summary>
 public static IAbstractionContext Property(this IAbstractionLayer layer, object dump) => new AbstractionContext(layer, dump);
示例#10
0
 /// <summary>
 /// Logs variables. The dump must be an anonymous type with at least one property: new { foo[, bar] }
 /// </summary>
 public static IAbstractionContext Variable(this IAbstractionLayer layer, object dump) => new AbstractionContext(layer, dump);
示例#11
0
 public AbstractionLayerRoutine(IAbstractionLayer layer, string identifier, [CallerMemberName] string categoryName = null)
     : base(layer, categoryName)
 {
     Identifier = identifier;
 }
示例#12
0
 public AbstractionContext(IAbstractionLayer layer, object dump, [CallerMemberName] string categoryName = null)
 {
     (LayerName, LogLevel) = layer;
     CategoryName          = categoryName;
     Dump = dump;
 }