private void log(LogLevel logLevel, LogStatement logStatement)
        {
            if (logLevel >= Level)
            {
                string logString = logStatement.AsString(Format, LogRequestBody, LogResponseBody);
                if (LogToConsole)
                {
                    Console.WriteLine(logString);
                }

                if (fs != null)
                {
                    try
                    {
                        byte[] info = new UTF8Encoding(true).GetBytes(String.Format("{0}\n", logString));
                        fs.Write(info, 0, info.Length);
                        fs.Flush();
                    }
                    catch (Exception)
                    {
                        // no-op
                    }
                }
            }
        }
        /// <summary>
        /// Logs a debug-level message
        /// </summary>
        /// <param name="method">HTTP Method</param>
        /// <param name="url">URL</param>
        /// <param name="requestBody">Request body</param>
        /// <param name="statusCode">HTTP status code</param>
        /// <param name="requestHeaders">Request headers</param>
        internal void Debug(string method,
                            string url,
                            object requestBody,
                            int statusCode,
                            Dictionary <String, String> requestHeaders)
        {
            LogStatement logStatement = new LogStatement(
                DateTime.UtcNow,
                "debug",
                method,
                url,
                requestHeaders,
                statusCode: statusCode,
                requestBody: requestBodyToString(requestBody)
                );

            log(LogLevel.LDebug, logStatement);
        }
        /// <summary>
        /// Logs a trace-level message
        /// </summary>
        /// <param name="method">HTTP Method</param>
        /// <param name="url">URL</param>
        /// <param name="requestBody">Request body</param>
        /// <param name="statusCode">HTTP status code</param>
        /// <param name="requestHeaders">Request headers</param>
        /// <param name="responseHeaders">Response headers</param>
        internal void Trace(string method,
                            string url,
                            object requestBody,
                            int statusCode,
                            Dictionary <String, String> requestHeaders,
                            Dictionary <String, String> responseHeaders)
        {
            LogStatement logStatement = new LogStatement(
                DateTime.UtcNow,
                "trace",
                method,
                url,
                requestHeaders,
                responseHeaders,
                statusCode,
                requestBodyToString(requestBody)
                );

            log(LogLevel.LTrace, logStatement);
        }