mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Removed verbose request log option
This commit is contained in:
parent
fee0f5c384
commit
214b3c7a97
3 changed files with 2 additions and 87 deletions
|
@ -44,8 +44,6 @@ public class Uploader
|
|||
public List<string> Errors { get; private set; } = new List<string>();
|
||||
public bool IsError => !StopUploadRequested && Errors != null && Errors.Count > 0;
|
||||
public int BufferSize { get; set; } = 8192;
|
||||
public bool VerboseLogs { get; set; }
|
||||
public string VerboseLogsPath { get; set; }
|
||||
|
||||
protected bool StopUploadRequested { get; set; }
|
||||
protected bool AllowReportProgress { get; set; } = true;
|
||||
|
@ -54,7 +52,6 @@ public class Uploader
|
|||
protected ResponseInfo LastResponseInfo { get; set; }
|
||||
|
||||
private HttpWebRequest currentWebRequest;
|
||||
private Logger verboseLogger;
|
||||
|
||||
public static void UpdateServicePointManager()
|
||||
{
|
||||
|
@ -119,14 +116,7 @@ protected string SendRequest(HttpMethod method, string url, Stream data, string
|
|||
{
|
||||
using (HttpWebResponse webResponse = GetResponse(method, url, data, contentType, args, headers, cookies))
|
||||
{
|
||||
string response = ProcessWebResponse(webResponse);
|
||||
|
||||
if (VerboseLogs && !string.IsNullOrEmpty(VerboseLogsPath))
|
||||
{
|
||||
WriteVerboseLog(url, args, headers, response);
|
||||
}
|
||||
|
||||
return response;
|
||||
return ProcessWebResponse(webResponse);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,14 +172,7 @@ protected string SendRequestMultiPart(string url, Dictionary<string, string> arg
|
|||
|
||||
using (HttpWebResponse webResponse = GetResponse(method, url, stream, contentType, null, headers, cookies))
|
||||
{
|
||||
string response = ProcessWebResponse(webResponse);
|
||||
|
||||
if (VerboseLogs && !string.IsNullOrEmpty(VerboseLogsPath))
|
||||
{
|
||||
WriteVerboseLog(url, args, headers, response);
|
||||
}
|
||||
|
||||
return response;
|
||||
return ProcessWebResponse(webResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -257,11 +240,6 @@ protected UploadResult SendRequestFile(string url, Stream data, string fileName,
|
|||
{
|
||||
currentWebRequest = null;
|
||||
IsUploading = false;
|
||||
|
||||
if (VerboseLogs && !string.IsNullOrEmpty(VerboseLogsPath))
|
||||
{
|
||||
WriteVerboseLog(url, args, headers, result.Response);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -329,11 +307,6 @@ protected UploadResult SendRequestFileRange(string url, Stream data, string file
|
|||
{
|
||||
currentWebRequest = null;
|
||||
IsUploading = false;
|
||||
|
||||
if (VerboseLogs && !string.IsNullOrEmpty(VerboseLogsPath))
|
||||
{
|
||||
WriteVerboseLog(url, args, headers, result.Response);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -487,54 +460,6 @@ private string AddWebError(Exception e, string url)
|
|||
return response;
|
||||
}
|
||||
|
||||
private void WriteVerboseLog(string url, Dictionary<string, string> args, NameValueCollection headers, string response)
|
||||
{
|
||||
if (verboseLogger == null)
|
||||
{
|
||||
verboseLogger = new Logger(VerboseLogsPath)
|
||||
{
|
||||
MessageFormat = "Date: {0:yyyy-MM-dd HH:mm:ss.fff}\r\n{1}",
|
||||
StringWrite = false
|
||||
};
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine("URL: " + (url ?? ""));
|
||||
|
||||
if (args != null && args.Count > 0)
|
||||
{
|
||||
sb.AppendLine("Arguments:");
|
||||
|
||||
foreach (KeyValuePair<string, string> arg in args)
|
||||
{
|
||||
sb.AppendLine($" Name: {arg.Key}, Value: {arg.Value}");
|
||||
}
|
||||
}
|
||||
|
||||
if (headers != null && headers.Count > 0)
|
||||
{
|
||||
sb.AppendLine("Headers:");
|
||||
|
||||
foreach (string key in headers)
|
||||
{
|
||||
string value = headers[key];
|
||||
sb.AppendLine($" Name: {key}, Value: {value}");
|
||||
}
|
||||
}
|
||||
|
||||
sb.AppendLine("Response:");
|
||||
|
||||
if (!string.IsNullOrEmpty(response))
|
||||
{
|
||||
sb.AppendLine(response);
|
||||
}
|
||||
|
||||
sb.Append(new string('-', 30));
|
||||
|
||||
verboseLogger.WriteLine(sb.ToString());
|
||||
}
|
||||
|
||||
private HttpWebRequest CreateWebRequest(HttpMethod method, string url, NameValueCollection headers = null, CookieCollection cookies = null,
|
||||
string contentType = null, long contentLength = 0)
|
||||
{
|
||||
|
|
|
@ -222,9 +222,6 @@ public int HotkeyRepeatLimit
|
|||
[Category("Upload"), DefaultValue(false), Description("Accept invalid SSL certificates when uploading.")]
|
||||
public bool AcceptInvalidSSLCertificates { get; set; }
|
||||
|
||||
[Category("Upload"), DefaultValue(false), Description("Writes verbose web request logs to \"{PersonalFolder}\\Logs\\ShareX-Request-Logs.txt\" file for debugging purposes.")]
|
||||
public bool VerboseRequestLogs { get; set; }
|
||||
|
||||
[Category("Upload"), DefaultValue(true), Description("Show first time upload warning.")]
|
||||
public bool ShowUploadWarning { get; set; }
|
||||
|
||||
|
|
|
@ -839,13 +839,6 @@ public UploadResult UploadData(IGenericUploaderService service, Stream stream, s
|
|||
if (uploader != null)
|
||||
{
|
||||
uploader.BufferSize = (int)Math.Pow(2, Program.Settings.BufferSizePower) * 1024;
|
||||
|
||||
if (Program.Settings.VerboseRequestLogs)
|
||||
{
|
||||
uploader.VerboseLogs = true;
|
||||
uploader.VerboseLogsPath = Program.RequestLogsFilePath;
|
||||
}
|
||||
|
||||
uploader.ProgressChanged += uploader_ProgressChanged;
|
||||
|
||||
if (Info.TaskSettings.AfterUploadJob.HasFlag(AfterUploadTasks.CopyURLToClipboard) && Info.TaskSettings.AdvancedSettings.EarlyCopyURL)
|
||||
|
|
Loading…
Reference in a new issue