diff --git a/src/Microsoft.AspNet.Diagnostics.Elm/ElmExtensions.cs b/src/Microsoft.AspNet.Diagnostics.Elm/ElmExtensions.cs index 29811f5f84..5c88ebe038 100644 --- a/src/Microsoft.AspNet.Diagnostics.Elm/ElmExtensions.cs +++ b/src/Microsoft.AspNet.Diagnostics.Elm/ElmExtensions.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; using Jetbrains.Annotations; using Microsoft.AspNet.Diagnostics.Elm; using Microsoft.Framework.DependencyInjection; @@ -33,14 +32,5 @@ namespace Microsoft.AspNet.Builder { return builder.UseMiddleware(); } - - /// - /// Registers an and configures . - /// - public static IServiceCollection AddElm([NotNull] this IServiceCollection services, Action configureOptions = null) - { - services.AddSingleton(); // registering the service so it can be injected into constructors - return services.Configure(configureOptions ?? (o => { })); - } } } \ No newline at end of file diff --git a/src/Microsoft.AspNet.Diagnostics.Elm/ElmServiceCollectionExtensions.cs b/src/Microsoft.AspNet.Diagnostics.Elm/ElmServiceCollectionExtensions.cs new file mode 100644 index 0000000000..eb35d52937 --- /dev/null +++ b/src/Microsoft.AspNet.Diagnostics.Elm/ElmServiceCollectionExtensions.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using Jetbrains.Annotations; +using Microsoft.AspNet.Diagnostics.Elm; + +namespace Microsoft.Framework.DependencyInjection +{ + public static class ElmServiceCollectionExtensions + { + /// + /// Registers an and configures . + /// + public static IServiceCollection AddElm([NotNull] this IServiceCollection services) + { + return services.AddElm(configureOptions: null); + } + + /// + /// Registers an and configures . + /// + public static IServiceCollection AddElm([NotNull] this IServiceCollection services, Action configureOptions) + { + services.AddSingleton(); // registering the service so it can be injected into constructors + + if (configureOptions != null) + { + services.Configure(configureOptions); + } + + return services; + } + } +} \ No newline at end of file diff --git a/test/Microsoft.AspNet.Diagnostics.Tests/ElmLoggerTest.cs b/test/Microsoft.AspNet.Diagnostics.Tests/ElmLoggerTest.cs index 597b740a96..e17acb48b5 100644 --- a/test/Microsoft.AspNet.Diagnostics.Tests/ElmLoggerTest.cs +++ b/test/Microsoft.AspNet.Diagnostics.Tests/ElmLoggerTest.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; using System.Collections.Generic; using System.Linq; using System.Threading;