diff --git a/src/Microsoft.Extensions.Logging.Abstractions/NullLoggerFactory.cs b/src/Microsoft.Extensions.Logging.Abstractions/NullLoggerFactory.cs new file mode 100644 index 00000000..9897e89d --- /dev/null +++ b/src/Microsoft.Extensions.Logging.Abstractions/NullLoggerFactory.cs @@ -0,0 +1,35 @@ +// 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. + +namespace Microsoft.Extensions.Logging.Abstractions +{ + /// + /// An used to create instance of + /// that logs nothing. + /// + public class NullLoggerFactory : ILoggerFactory + { + public static readonly NullLoggerFactory Instance = new NullLoggerFactory(); + + /// + /// + /// This returns a instance which logs nothing. + /// + public ILogger CreateLogger(string name) + { + return NullLogger.Instance; + } + + /// + /// + /// This method ignores the parameter and does nothing. + /// + public void AddProvider(ILoggerProvider provider) + { + } + + public void Dispose() + { + } + } +} \ No newline at end of file