// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Threading; using System.Threading.Tasks; namespace System.Web.Http.ExceptionHandling { /// Provides extension methods for . public static class ExceptionLoggerExtensions { /// Calls an exception logger. /// The unhandled exception logger. /// The exception context. /// The token to monitor for cancellation requests. /// A task representing the asynchronous exception logging operation. public static Task LogAsync(this IExceptionLogger logger, ExceptionContext context, CancellationToken cancellationToken) { if (logger == null) { throw new ArgumentNullException("logger"); } if (context == null) { throw new ArgumentNullException("context"); } ExceptionLoggerContext loggerContext = new ExceptionLoggerContext(context); return logger.LogAsync(loggerContext, cancellationToken); } } }