<PackageReference Include="NLog" Version="6.1.1" />

NLog.Targets.MethodCallTarget

public sealed class MethodCallTarget : MethodCallTargetBase
Calls the specified static method on each log message and passes contextual parameters to it.
public string ClassName { get; set; }

Gets or sets the class name.

public string MethodName { get; set; }

Gets or sets the method name. The method must be public and static. Use the AssemblyQualifiedName -

Initializes a new instance of the MethodCallTarget class.

public MethodCallTarget(string name)

Initializes a new instance of the MethodCallTarget class.

public MethodCallTarget(string name, Action<LogEventInfo, object[]> logEventAction)

Initializes a new instance of the MethodCallTarget class.