Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0d3aacd
WIP
JamesNK May 8, 2023
b0b9f7f
WIP
JamesNK May 9, 2023
e363c40
Scope pipeline
JamesNK May 10, 2023
03c7c4d
Fix tests
JamesNK May 17, 2023
6f6b24f
Update tests
JamesNK May 17, 2023
5f89fed
Update
JamesNK May 18, 2023
ea549cb
Fix tests
JamesNK May 22, 2023
f10e692
Clean up
JamesNK May 22, 2023
b70e514
WIP enrichment
JamesNK May 22, 2023
aab22f7
Remove extra LogEntry and make changes for enrichment
JamesNK May 22, 2023
f247a78
Public API clean up
JamesNK May 24, 2023
3adbf03
Clean up and move enrichment into Extensions.Logging
JamesNK May 24, 2023
a069f8a
Remove old log entry
JamesNK May 26, 2023
c3fd52b
Redecation example and tests
JamesNK May 28, 2023
39ad281
API clean up
JamesNK May 28, 2023
4671d54
Clean up
JamesNK May 29, 2023
2e6bf33
Get values from redacted state
JamesNK May 29, 2023
9fcaa89
Clean up redaction properties
JamesNK May 30, 2023
4a6dab5
Remove dynamic check on scope pipeline
JamesNK May 30, 2023
4ccdd22
Remove ILoggerStateWithMetadata<TState>
JamesNK May 30, 2023
5b6951e
Enrichment feedback. Fix registering multiple processors
JamesNK May 31, 2023
337bf21
Remove Pipeline types from public API
noahfalk Jun 5, 2023
30fc523
Simplifying public API and cutting enrichment
noahfalk Jun 14, 2023
85c3d44
Remove LogValuesFormatter
noahfalk Jun 14, 2023
1e86406
Feedback from James
noahfalk Jun 16, 2023
7a27012
Using new data classification model
sebastienros Jun 20, 2023
5c30525
Merge pull request #1 from sebastienros/sebros/dataclassification
noahfalk Jun 21, 2023
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 @@ -21,11 +21,30 @@ namespace Microsoft.Extensions.Logging
public static bool operator !=(Microsoft.Extensions.Logging.EventId left, Microsoft.Extensions.Logging.EventId right) { throw null; }
public override string ToString() { throw null; }
}
public delegate void VisitPropertyListAction<TState, TCookie>(ref TState state, ref System.Span<byte> spanCookie, ref TCookie cookie);
public delegate void VisitPropertyAction<PropType, TCookie>(int propIndex, PropType propValue, ref System.Span<byte> spanCookie, ref TCookie cookie);
public delegate void VisitSpanPropertyAction<TCookie>(int propIndex, scoped System.ReadOnlySpan<char> propValue, ref System.Span<byte> spanCookie, ref TCookie cookie);

public interface IPropertyVisitorFactory<TCookie>
{
VisitPropertyAction<PropType, TCookie> GetPropertyVisitor<PropType>();
VisitSpanPropertyAction<TCookie> GetSpanPropertyVisitor();
}
public partial interface IExternalScopeProvider
{
void ForEachScope<TState>(System.Action<object?, TState> callback, TState state);
System.IDisposable Push(object? state);
}
public partial interface ILogEntryProcessor
{
Microsoft.Extensions.Logging.LogEntryHandler<TState> GetLogEntryHandler<TState>(Microsoft.Extensions.Logging.ILogMetadata<TState>? metadata, out bool enabled, out bool dynamicEnabledCheckRequired);
Microsoft.Extensions.Logging.ScopeHandler<TState> GetScopeHandler<TState>(Microsoft.Extensions.Logging.ILogMetadata<TState>? metadata, out bool enabled) where TState : notnull;
bool IsEnabled(Microsoft.Extensions.Logging.LogLevel logLevel);
}
public partial interface ILogEntryProcessorFactory
{
Microsoft.Extensions.Logging.ProcessorContext GetProcessor();
}
public partial interface ILogger
{
System.IDisposable? BeginScope<TState>(TState state) where TState : notnull;
Expand All @@ -44,15 +63,35 @@ public partial interface ILoggerProvider : System.IDisposable
public partial interface ILogger<out TCategoryName> : Microsoft.Extensions.Logging.ILogger
{
}
public partial interface ILogMetadata<TState>
{
Microsoft.Extensions.Logging.EventId EventId { get; }
Microsoft.Extensions.Logging.LogLevel LogLevel { get; }
string OriginalFormat { get; }
int PropertyCount { get; }
Microsoft.Extensions.Logging.LogPropertyInfo GetPropertyInfo(int index);
Microsoft.Extensions.Logging.VisitPropertyListAction<TState, TCookie> CreatePropertyListVisitor<TCookie>(Microsoft.Extensions.Logging.IPropertyVisitorFactory<TCookie> propertyVisitorFactory);
}
public partial interface IProcessorFactory
{
Microsoft.Extensions.Logging.ILogEntryProcessor GetProcessor(Microsoft.Extensions.Logging.ILogEntryProcessor nextProcessor);
}
public partial interface ISupportExternalScope
{
void SetScopeProvider(Microsoft.Extensions.Logging.IExternalScopeProvider scopeProvider);
}
public partial class LogDefineOptions
{
public LogDefineOptions() { }
public object[]?[]? ParameterMetadata { get { throw null; } set { } }
public bool SkipEnabledCheck { get { throw null; } set { } }
}
public abstract partial class LogEntryHandler<TState>
{
protected LogEntryHandler() { }
public abstract void HandleLogEntry(ref Microsoft.Extensions.Logging.Abstractions.LogEntry<TState> logEntry);
public abstract bool IsEnabled(Microsoft.Extensions.Logging.LogLevel level);
}
public static partial class LoggerExtensions
{
public static System.IDisposable? BeginScope(this Microsoft.Extensions.Logging.ILogger logger, string messageFormat, params object?[] args) { throw null; }
Expand Down Expand Up @@ -107,6 +146,7 @@ public static partial class LoggerMessage
public static System.Func<Microsoft.Extensions.Logging.ILogger, T1, T2, T3, T4, System.IDisposable?> DefineScope<T1, T2, T3, T4>(string formatString) { throw null; }
public static System.Func<Microsoft.Extensions.Logging.ILogger, T1, T2, T3, T4, T5, System.IDisposable?> DefineScope<T1, T2, T3, T4, T5>(string formatString) { throw null; }
public static System.Func<Microsoft.Extensions.Logging.ILogger, T1, T2, T3, T4, T5, T6, System.IDisposable?> DefineScope<T1, T2, T3, T4, T5, T6>(string formatString) { throw null; }
public static Microsoft.Extensions.Logging.LoggerMessage.Log<TState> Define<TState>(Microsoft.Extensions.Logging.ILogMetadata<TState> metadata, Microsoft.Extensions.Logging.LogDefineOptions? options = null) { throw null; }
public static System.Action<Microsoft.Extensions.Logging.ILogger, T1, System.Exception?> Define<T1>(Microsoft.Extensions.Logging.LogLevel logLevel, Microsoft.Extensions.Logging.EventId eventId, string formatString) { throw null; }
public static System.Action<Microsoft.Extensions.Logging.ILogger, T1, System.Exception?> Define<T1>(Microsoft.Extensions.Logging.LogLevel logLevel, Microsoft.Extensions.Logging.EventId eventId, string formatString, Microsoft.Extensions.Logging.LogDefineOptions? options) { throw null; }
public static System.Action<Microsoft.Extensions.Logging.ILogger, T1, T2, System.Exception?> Define<T1, T2>(Microsoft.Extensions.Logging.LogLevel logLevel, Microsoft.Extensions.Logging.EventId eventId, string formatString) { throw null; }
Expand All @@ -119,6 +159,7 @@ public static partial class LoggerMessage
public static System.Action<Microsoft.Extensions.Logging.ILogger, T1, T2, T3, T4, T5, System.Exception?> Define<T1, T2, T3, T4, T5>(Microsoft.Extensions.Logging.LogLevel logLevel, Microsoft.Extensions.Logging.EventId eventId, string formatString, Microsoft.Extensions.Logging.LogDefineOptions? options) { throw null; }
public static System.Action<Microsoft.Extensions.Logging.ILogger, T1, T2, T3, T4, T5, T6, System.Exception?> Define<T1, T2, T3, T4, T5, T6>(Microsoft.Extensions.Logging.LogLevel logLevel, Microsoft.Extensions.Logging.EventId eventId, string formatString) { throw null; }
public static System.Action<Microsoft.Extensions.Logging.ILogger, T1, T2, T3, T4, T5, T6, System.Exception?> Define<T1, T2, T3, T4, T5, T6>(Microsoft.Extensions.Logging.LogLevel logLevel, Microsoft.Extensions.Logging.EventId eventId, string formatString, Microsoft.Extensions.Logging.LogDefineOptions? options) { throw null; }
public delegate void Log<TState>(Microsoft.Extensions.Logging.ILogger logger, ref TState state, System.Exception? exception);
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method)]
public sealed partial class LoggerMessageAttribute : System.Attribute
Expand All @@ -131,10 +172,11 @@ public LoggerMessageAttribute(int eventId, Microsoft.Extensions.Logging.LogLevel
public string Message { get { throw null; } set { } }
public bool SkipEnabledCheck { get { throw null; } set { } }
}
public partial class Logger<T> : Microsoft.Extensions.Logging.ILogger, Microsoft.Extensions.Logging.ILogger<T>
public partial class Logger<T> : Microsoft.Extensions.Logging.ILogger, Microsoft.Extensions.Logging.ILogger<T>, Microsoft.Extensions.Logging.ILogEntryProcessorFactory
{
public Logger(Microsoft.Extensions.Logging.ILoggerFactory factory) { }
System.IDisposable? Microsoft.Extensions.Logging.ILogger.BeginScope<TState>(TState state) { throw null; }
public ProcessorContext GetProcessor() { throw null; }
System.IDisposable Microsoft.Extensions.Logging.ILogger.BeginScope<TState>(TState state) { throw null; }
bool Microsoft.Extensions.Logging.ILogger.IsEnabled(Microsoft.Extensions.Logging.LogLevel logLevel) { throw null; }
void Microsoft.Extensions.Logging.ILogger.Log<TState>(Microsoft.Extensions.Logging.LogLevel logLevel, Microsoft.Extensions.Logging.EventId eventId, TState state, System.Exception? exception, System.Func<TState, System.Exception?, string> formatter) { }
}
Expand All @@ -148,6 +190,41 @@ public enum LogLevel
Critical = 5,
None = 6,
}
public partial struct LogPropertyInfo
{
private object _dummy;
private int _dummyPrimitive;
public LogPropertyInfo(string name, object[]? metadata) { throw null; }
public readonly System.Collections.Generic.IReadOnlyList<object>? Metadata { get { throw null; } }
public readonly string Name { get { throw null; } }
}
public readonly partial struct ProcessorContext
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public ProcessorContext(Microsoft.Extensions.Logging.ILogEntryProcessor processor, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.CancellationToken CancellationToken { get { throw null; } }
public Microsoft.Extensions.Logging.ILogEntryProcessor Processor { get { throw null; } }
}
public partial class ProcessorFactory<T> : Microsoft.Extensions.Logging.IProcessorFactory where T : Microsoft.Extensions.Logging.ILogEntryProcessor
{
public ProcessorFactory(System.Func<Microsoft.Extensions.Logging.ILogEntryProcessor, T> getProcessor) { }
public Microsoft.Extensions.Logging.ILogEntryProcessor GetProcessor(Microsoft.Extensions.Logging.ILogEntryProcessor nextProcessor) { throw null; }
}
public abstract partial class ScopeHandler<TState> where TState : notnull
{
protected ScopeHandler() { }
public abstract System.IDisposable? HandleBeginScope(ref TState state);
public abstract bool IsEnabled(Microsoft.Extensions.Logging.LogLevel level);
}

public delegate void FormatLogMessage<TState>(ref TState state, System.Buffers.IBufferWriter<byte> bufferWriter);

public static partial class LogMetadataExtensions
{
public static FormatLogMessage<TState> CreateMessageFormatter<TState>(this ILogMetadata<TState> metadata) { throw null; }
public static System.Func<TState, System.Exception?, string> CreateStringMessageFormatter<TState>(this ILogMetadata<TState> metadata) { throw null; }
}
}
namespace Microsoft.Extensions.Logging.Abstractions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@
<ItemGroup>
<Compile Include="Microsoft.Extensions.Logging.Abstractions.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
<PackageReference Include="System.Buffers" Version="$(SystemBuffersVersion)" />
<PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.CompilerServices;

namespace Microsoft.Extensions.Logging
{
// ByReference<T> is meant to be used to represent "ref T" fields. It is working
// around lack of first class support for byref fields in C# and IL. The JIT and
// type loader has special handling for it that turns it into a thin wrapper around ref T.
internal struct ByReference<T>
{
private IntPtr _value;

public ByReference(ref T value)
{
// TODO-SPAN: This has GC hole. It needs to be JIT intrinsic instead
unsafe { _value = (IntPtr)Unsafe.AsPointer(ref value); }
}

public ref T Value
{
get
{
// TODO-SPAN: This has GC hole. It needs to be JIT intrinsic instead
unsafe { return ref Unsafe.As<IntPtr, T>(ref *(IntPtr*)_value); }
}
}
}
}
Loading