-
Notifications
You must be signed in to change notification settings - Fork 111
Open
Description
AS-IS
The logger is passed as a parameter:
public static partial class MyLogger
{
[ZLoggerMessage(LogLevel.Information, "Bar: {x} {y}")]
public static partial void Bar(this ILogger<Foo> logger, int x, int y);
}
TO BE
Support instance context, to have logger obtained from field or primary ctor param:
public partial class InstanceLoggingExample
{
private readonly ILogger _logger;
public InstanceLoggingExample(ILogger logger)
{
_logger = logger;
}
[ZLoggerMessage(LogLevel.Information, "Bar: {x} {y}")]
public partial void Bar(int x, int y);
}
public partial class PrimaryCtorLoggingExample(ILogger logger)
{
[ZLoggerMessage(LogLevel.Information, "Bar: {x} {y}")]
public partial void Bar(int x, int y);
}
Metadata
Metadata
Assignees
Labels
No labels