ArchiSteamFarm.ArchiLogger.LogGenericDebugException C# (CSharp) Метод

LogGenericDebugException() приватный Метод

private LogGenericDebugException ( Exception exception, [ previousMethodName = null ) : void
exception System.Exception
previousMethodName [
Результат void
        internal void LogGenericDebugException(Exception exception, [CallerMemberName] string previousMethodName = null)
        {
            if (exception == null) {
                LogNullError(nameof(exception));
                return;
            }

            Logger.Debug(exception, $"{previousMethodName}()");
        }

Usage Example

Пример #1
0
        private async Task <HttpResponseMessage> UrlRequest(string request, HttpMethod httpMethod, IEnumerable <KeyValuePair <string, string> > data = null, string referer = null)
        {
            if (string.IsNullOrEmpty(request) || (httpMethod == null))
            {
                ArchiLogger.LogNullError(nameof(request) + " || " + nameof(httpMethod));
                return(null);
            }

            HttpResponseMessage responseMessage;

            using (HttpRequestMessage requestMessage = new HttpRequestMessage(httpMethod, request)) {
                if (data != null)
                {
                    try {
                        requestMessage.Content = new FormUrlEncodedContent(data);
                    } catch (UriFormatException e) {
                        ArchiLogger.LogGenericException(e);
                        return(null);
                    }
                }

                if (!string.IsNullOrEmpty(referer))
                {
                    requestMessage.Headers.Referrer = new Uri(referer);
                }

                try {
                    responseMessage = await HttpClient.SendAsync(requestMessage).ConfigureAwait(false);
                } catch (Exception e) {
                    // This exception is really common, don't bother with it unless debug mode is enabled
                    if (Debugging.IsUserDebugging)
                    {
                        ArchiLogger.LogGenericDebugException(e);
                    }

                    return(null);
                }
            }

            if (responseMessage == null)
            {
                return(null);
            }

            if (responseMessage.IsSuccessStatusCode)
            {
                return(responseMessage);
            }

            if (Debugging.IsUserDebugging)
            {
                ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, request));
                ArchiLogger.LogGenericDebug(string.Format(Strings.StatusCode, responseMessage.StatusCode));
                ArchiLogger.LogGenericDebug(string.Format(Strings.Content, await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false)));
            }

            responseMessage.Dispose();
            return(null);
        }
All Usage Examples Of ArchiSteamFarm.ArchiLogger::LogGenericDebugException