コード例 #1
0
ファイル: LogUtils.cs プロジェクト: arielarmijos/Api
        public static void LogMethodInvocationStart(Boolean clearThreadData, params Object[] parameters)
        {
            if (clearThreadData)
            {
                _methodInvocationID = null;
            }
            else
            {
                _methodInvocationID = new ThreadLocal <String>(() => Thread.CurrentThread.ManagedThreadId.ToString() + DateTime.Now.ToString("HHmmssfffff"));
            }

            StackTrace stack     = new StackTrace();
            String     methodFQN = stack.GetFrames()[1].GetMethod().DeclaringType.ToString() + "." + stack.GetFrames()[1].GetMethod().Name;

            StringBuilder sb = new StringBuilder();

            foreach (Object parameter in parameters)
            {
                Type parameterType = parameter.GetType();

                foreach (PropertyInfo propertyInfo in parameterType.GetProperties())
                {
                    if (propertyInfo.GetCustomAttributes(typeof(NotLoggableAttribute), false).Count() == 0)
                    {
                        sb.Append(propertyInfo.Name).Append("=").Append(propertyInfo.GetValue(parameter, null));
                        sb.Append("|");
                    }
                }
            }
            ApiServiceBase.Log(Logger.LogMessageType.Info, "MethodInvocation: " + methodFQN + "Data: " + sb.ToString(), Logger.LoggingLevelType.Low);
        }
コード例 #2
0
        public ApiEngineRunStrategyBase(ApplicationServiceBase appService,
                                        AppCrossOriginServiceBase appCrossOriginService,
                                        ApiClientServiceBase clientService,
                                        ApiClientCustomerHubService customerHubService,
                                        ApiClientCustomerServiceBase customerService,
                                        ApiClientIPServiceBase clientIPService,
                                        ApiServiceBase apiService,
                                        ApiSettingServiceBase apiSettingService,
                                        IBase64Compression compression,
                                        IDebugRequestGetter debugger,
                                        IEncryption crypt,
                                        IExceptionLogger logger,
                                        ITranslation translator,
                                        ICacheFactory cacheFactory)
        {
            if (appService == null)
            {
                throw new ArgumentNullException("appService");
            }
            if (appCrossOriginService == null)
            {
                throw new ArgumentNullException("appCrossOriginService");
            }
            if (clientService == null)
            {
                throw new ArgumentNullException("clientService");
            }
            if (customerHubService == null)
            {
                throw new ArgumentNullException("customerHubService");
            }
            if (customerService == null)
            {
                throw new ArgumentNullException("customerService");
            }
            if (clientIPService == null)
            {
                throw new ArgumentNullException("clientIPService");
            }
            if (apiService == null)
            {
                throw new ArgumentNullException("apiService");
            }
            if (apiSettingService == null)
            {
                throw new ArgumentNullException("apiSettingService");
            }
            if (compression == null)
            {
                throw new ArgumentNullException("compression");
            }
            if (debugger == null)
            {
                throw new ArgumentNullException("debugger");
            }
            if (crypt == null)
            {
                throw new ArgumentNullException("crypt");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }
            if (translator == null)
            {
                throw new ArgumentNullException("translator");
            }
            if (cacheFactory == null)
            {
                throw new ArgumentNullException("cacheFactory");
            }

            this.appService            = appService;
            this.appCrossOriginService = appCrossOriginService;
            this.clientService         = clientService;
            this.customerHubService    = customerHubService;
            this.customerService       = customerService;
            this.clientIPService       = clientIPService;
            this.apiService            = apiService;
            this.compression           = compression;
            this.debugger          = debugger;
            this.crypt             = crypt;
            this.logger            = logger;
            this.translator        = translator;
            this.cacheFactory      = cacheFactory;
            this.apiSettingService = apiSettingService;
        }