Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
using System;
using System.Threading;

namespace Microsoft.VisualStudio.Razor.Logging;
namespace Microsoft.CodeAnalysis.Razor.Logging;

internal partial class MemoryLoggerProvider
internal partial class AbstractMemoryLoggerProvider
{
/// <summary>
/// A circular in memory buffer to store logs in memory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using Microsoft.CodeAnalysis.Razor.Logging;

namespace Microsoft.VisualStudio.Razor.Logging;
namespace Microsoft.CodeAnalysis.Razor.Logging;

internal partial class MemoryLoggerProvider
internal partial class AbstractMemoryLoggerProvider
{
private class Logger(Buffer buffer, string categoryName) : ILogger
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace Microsoft.CodeAnalysis.Razor.Logging;

internal abstract partial class AbstractMemoryLoggerProvider : ILoggerProvider
{
// How many messages will the buffer contain
private const int BufferSize = 5000;
private readonly Buffer _buffer = new(BufferSize);

public ILogger CreateLogger(string categoryName)
=> new Logger(_buffer, categoryName);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.CodeAnalysis.Razor.Logging;

namespace Microsoft.CodeAnalysis.Remote.Razor.Logging;

internal sealed class MemoryLoggerProvider : AbstractMemoryLoggerProvider
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@

namespace Microsoft.CodeAnalysis.Remote.Razor.Logging;

internal sealed partial class TraceSourceLoggerFactory(TraceSource traceSource) : AbstractLoggerFactory([new LoggerProvider(traceSource)])
internal sealed partial class TraceSourceLoggerFactory(TraceSource traceSource)
: AbstractLoggerFactory([
new LoggerProvider(traceSource),
new MemoryLoggerProvider()])
{
public TraceSource TraceSource { get; } = traceSource;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@
namespace Microsoft.VisualStudio.Razor.Logging;

[ExportLoggerProvider]
internal partial class MemoryLoggerProvider : ILoggerProvider
internal sealed class MemoryLoggerProvider : AbstractMemoryLoggerProvider
{
// How many messages will the buffer contain
private const int BufferSize = 5000;
private readonly Buffer _buffer = new(BufferSize);

public ILogger CreateLogger(string categoryName)
=> new Logger(_buffer, categoryName);
}
Loading