public static IDisposable ActionScope(this ILogger logger, ActionDescriptor action) { return logger.BeginScopeImpl(new ActionLogScope(action)); }
public static IDisposable RequestScope(this ILogger logger, HttpContext httpContext) { return logger.BeginScopeImpl(new HostingLogScope(httpContext)); }
//------------------------------------------Scope------------------------------------------// /// <summary> /// Formats the message and creates a scope. /// </summary> /// <param name="logger">The <see cref="ILogger"/> to create the scope in.</param> /// <param name="messageFormat">Format string of the scope message.</param> /// <param name="args">An object array that contains zero or more objects to format.</param> /// <returns>A disposable scope object. Can be null.</returns> public static IDisposable BeginScope( this ILogger logger, string messageFormat, params object[] args) { if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (messageFormat == null) { throw new ArgumentNullException(nameof(messageFormat)); } return logger.BeginScopeImpl(new FormattedLogValues(messageFormat, args)); }
public static IDisposable ViewComponentScope(this ILogger logger, ViewComponentContext context) { return logger.BeginScopeImpl(new ViewComponentLogScope(context.ViewComponentDescriptor)); }