How to log the current calling method?

Jul 18, 2012 at 7:46 AM

Hello,

I've added a logging feature to my application, but I got a problem.. consider the method below

 

  public IEnumerator<IResult> LoadData()
        {
            IsBusy = true;
            OperationResult<IEnumerable<VARIABILI>> operation;
            OperationResult<IEnumerable<ANA_TIPO_VARIABILE>> operationVariabili;

            yield return (operation = repository.LoadVariabili()).ContinueOnError();

            if (operation.CompletedSuccessfully)
                DataItems = new BindableCollection<VARIABILI>(operation.Result);

            if (operation.HasError)
            {
                yield return ErrorHandler.HandleError(operation.Error).ToSequentialResult();
            }

            yield return (operationVariabili = repository.LoadTipoVariabili()).ContinueOnError();

            if (operationVariabili.CompletedSuccessfully)
                ListaTipoVariabile = new BindableCollection<ANA_TIPO_VARIABILE>(operationVariabili.Result);

            if (operationVariabili.HasError)
            {
              yield return  ErrorHandler.HandleError(operationVariabili.Error).ToSequentialResult();
            }

            IsBusy = false;
        }

If I log the StackTrace I get the DB call stack... If I want to log that the LoadData method has been called, what should I do? I don't want to pass a string composing manually NameSpace.MethodName... I've tried using StackFrame but I get lost in CM events

 

Thanks