protected virtual ITracer InitializeWithCallerName(string environment, string serviceName, string methodName = null) { try { TokenManager.SetBootstrapToken(BootstrapContext); Runtime.SetBootstrapContext(BootstrapContext); Runtime.SetCurrentPrincipal(OperationContext.Current.ClaimsPrincipal != null && OperationContext.Current.ClaimsPrincipal.Identity.IsAuthenticated ? OperationContext.Current.ClaimsPrincipal: HttpContext.Current.User); } catch (Exception ex) { ex.Log(); } if (Tracer.IsInstance()) { return(Tracer); } var callerName = GetCallerName(methodName); Runtime = RuntimeFactory.CreateRuntime(); if (environment.ContainsCharacters()) { Runtime.SetEnvironment(environment); } var tracer = Runtime.SetServiceName(this, serviceName, callerName); tracer.GetCallstack().Name = GetServiceName(); tracer.SetAdidtionalInformation(Runtime.InstanceId.ToString()); Tracer = tracer; return(tracer); }
public ITracer SetServiceName(object callingInstance, string serviceName, string methodName) { ServiceName = serviceName; if (Tracer.IsInstance() && !Tracer.IsDisposed) { return(Tracer); } Tracer = TracerFactory.StartTracer(callingInstance, serviceName, methodName); CallStack = Tracer.GetCallstack(); return(Tracer); }