Add some missing doc comments

This commit is contained in:
Ryan Brandenburg 2019-06-27 15:58:43 -07:00
parent 92ead8b790
commit 8bce347b3b
4 changed files with 34 additions and 2 deletions

View File

@ -5,6 +5,9 @@ using System;
namespace Microsoft.Extensions.Logging.AzureAppServices namespace Microsoft.Extensions.Logging.AzureAppServices
{ {
/// <summary>
/// Options for a logger which batches up log messages.
/// </summary>
public class BatchingLoggerOptions public class BatchingLoggerOptions
{ {
private int? _batchSize; private int? _batchSize;

View File

@ -10,7 +10,10 @@ using Microsoft.Extensions.Options;
namespace Microsoft.Extensions.Logging.AzureAppServices namespace Microsoft.Extensions.Logging.AzureAppServices
{ {
public abstract class BatchingLoggerProvider: ILoggerProvider, ISupportExternalScope /// <summary>
/// A provider of <see cref="BatchingLogger"/>'s.
/// </summary>
public abstract class BatchingLoggerProvider : ILoggerProvider, ISupportExternalScope
{ {
private readonly List<LogMessage> _currentBatch = new List<LogMessage>(); private readonly List<LogMessage> _currentBatch = new List<LogMessage>();
private readonly TimeSpan _interval; private readonly TimeSpan _interval;
@ -51,6 +54,9 @@ namespace Microsoft.Extensions.Logging.AzureAppServices
UpdateOptions(options.CurrentValue); UpdateOptions(options.CurrentValue);
} }
/// <summary>
/// Checks if the queue is enabled.
/// </summary>
public bool IsEnabled { get; private set; } public bool IsEnabled { get; private set; }
private void UpdateOptions(BatchingLoggerOptions options) private void UpdateOptions(BatchingLoggerOptions options)
@ -113,6 +119,12 @@ namespace Microsoft.Extensions.Logging.AzureAppServices
} }
} }
/// <summary>
/// Wait for the given <see cref="TimeSpan"/>.
/// </summary>
/// <param name="interval">The amount of time to wait.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that can be used to cancel the delay.</param>
/// <returns>A <see cref="Task"/> which completes when the <paramref name="interval"/> has passed or the <paramref name="cancellationToken"/> has been canceled.</returns>
protected virtual Task IntervalAsync(TimeSpan interval, CancellationToken cancellationToken) protected virtual Task IntervalAsync(TimeSpan interval, CancellationToken cancellationToken)
{ {
return Task.Delay(interval, cancellationToken); return Task.Delay(interval, cancellationToken);
@ -163,6 +175,7 @@ namespace Microsoft.Extensions.Logging.AzureAppServices
} }
} }
/// <inheritdoc/>
public void Dispose() public void Dispose()
{ {
_optionsChangeToken?.Dispose(); _optionsChangeToken?.Dispose();
@ -172,11 +185,20 @@ namespace Microsoft.Extensions.Logging.AzureAppServices
} }
} }
/// <summary>
/// Creates a <see cref="BatchingLogger"/> with the given <paramref name="categoryName"/>.
/// </summary>
/// <param name="categoryName">The name of the category to create this logger with.</param>
/// <returns>The <see cref="BatchingLogger"/> that was created.</returns>
public ILogger CreateLogger(string categoryName) public ILogger CreateLogger(string categoryName)
{ {
return new BatchingLogger(this, categoryName); return new BatchingLogger(this, categoryName);
} }
/// <summary>
/// Sets the scope on this provider.
/// </summary>
/// <param name="scopeProvider">Provides the scope.</param>
void ISupportExternalScope.SetScopeProvider(IExternalScopeProvider scopeProvider) void ISupportExternalScope.SetScopeProvider(IExternalScopeProvider scopeProvider)
{ {
_scopeProvider = scopeProvider; _scopeProvider = scopeProvider;

View File

@ -27,7 +27,7 @@ namespace Microsoft.Extensions.Logging.AzureAppServices
/// <summary> /// <summary>
/// Creates a new instance of <see cref="BlobLoggerProvider"/> /// Creates a new instance of <see cref="BlobLoggerProvider"/>
/// </summary> /// </summary>
/// <param name="options"></param> /// <param name="options">The options to use when creating a provider.</param>
public BlobLoggerProvider(IOptionsMonitor<AzureBlobLoggerOptions> options) public BlobLoggerProvider(IOptionsMonitor<AzureBlobLoggerOptions> options)
: this(options, null) : this(options, null)
{ {

View File

@ -10,6 +10,9 @@ using Microsoft.Extensions.Options;
namespace Microsoft.Extensions.Logging.AzureAppServices namespace Microsoft.Extensions.Logging.AzureAppServices
{ {
/// <summary>
/// A <see cref="BatchingLoggerProvider"/> which writes out to a file.
/// </summary>
[ProviderAlias("AzureAppServicesFile")] [ProviderAlias("AzureAppServicesFile")]
public class FileLoggerProvider : BatchingLoggerProvider public class FileLoggerProvider : BatchingLoggerProvider
{ {
@ -18,6 +21,10 @@ namespace Microsoft.Extensions.Logging.AzureAppServices
private readonly int? _maxFileSize; private readonly int? _maxFileSize;
private readonly int? _maxRetainedFiles; private readonly int? _maxRetainedFiles;
/// <summary>
/// Creates a new instance of <see cref="FileLoggerProvider"/>.
/// </summary>
/// <param name="options">The options to use when creating a provider.</param>
public FileLoggerProvider(IOptionsMonitor<AzureFileLoggerOptions> options) : base(options) public FileLoggerProvider(IOptionsMonitor<AzureFileLoggerOptions> options) : base(options)
{ {
var loggerOptions = options.CurrentValue; var loggerOptions = options.CurrentValue;