Я пытаюсь добавить логирование, похожее на https://github.com/Expecho/ServiceFabric-Remoting-CustomHeaders, используя Autofac.ServiceFabric.
В основном хотелось бы чего-то похожего на это, но с ILogger.
ActorRuntime.RegisterActorAsync<DemoActor> (
(context, actorType) =>
{
var service = new ExtendedActorService(context, actorType)
{
// Optional, log the call before the message is handled
BeforeHandleRequestResponseAsync = requestInfo =>
{
ActorEventSource.Current.Message($"BeforeHandleRequestResponseAsync {requestInfo.ActorService} {requestInfo.Method} for actor {requestInfo.ActorId.ToString()}");
return Task.FromResult<object>(null);
},
// Optional, log the call after the message is handled
AfterHandleRequestResponseAsync = reponseInfo =>
{
ActorEventSource.Current.Message($"AfterHandleRequestResponseAsync {reponseInfo.ActorService} {reponseInfo.Method} for actor {reponseInfo.ActorId.ToString()}");
return Task.FromResult<object>(null);
},
};
return service;
}).GetAwaiter().GetResult();
У меня не было проблем с удаленными вызовами, но я не могу найти способ внедрить ILogger в ActorService.
Я вижу внутри Autofac.ServiceFabric
return (ActorService)container.Resolve(
actorServiceType,
new TypedParameter(typeof(StatefulServiceContext), context),
new TypedParameter(typeof(ActorTypeInformation), actorTypeInfo),
new TypedParameter(typeof(Func<ActorService, ActorId, ActorBase>), (Func<ActorService, ActorId, ActorBase>)ActorFactory),
new TypedParameter(typeof(Func<ActorBase, IActorStateProvider, IActorStateManager>), stateManagerFactory),
new TypedParameter(typeof(IStateProvider), stateProvider),
new TypedParameter(typeof(ActorServiceSettings), settings));
, что может помешать мне использовать их код.
Есть идеи?