Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Added NullLoggerFactory to Logging.Abstractions #568

Merged
merged 1 commit into from
Mar 10, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/Microsoft.Extensions.Logging.Abstractions/NullLoggerFactory.cs
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary>
/// An <see cref="ILoggerFactory"/> used to create instance of
/// <see cref="NullLogger"/> that logs nothing.
/// </summary>
public class NullLoggerFactory : ILoggerFactory
{
public static readonly NullLoggerFactory Instance = new NullLoggerFactory();

/// <inheritdoc />
/// <remarks>
/// This returns a <see cref="NullLogger"/> instance which logs nothing.
/// </remarks>
public ILogger CreateLogger(string name)
{
return NullLogger.Instance;
}

/// <inheritdoc />
/// <remarks>
/// This method ignores the parameter and does nothing.
/// </remarks>
public void AddProvider(ILoggerProvider provider)
{
}

public void Dispose()
{
}
}
}