Amazon.TraceListener.DynamoDBTraceListener.AppendDocument C# (CSharp) Method

AppendDocument() private method

private AppendDocument ( Document doc ) : void
doc Document
return void
        private void AppendDocument(Document doc)
        {
            if (!IsEnabled) return;

            string json = null;
            try
            {
                // JsonMapper doesn't properly serialize Documents, so we store the attribute map
                Dictionary<string, AttributeValue> attributeMap = doc.ToAttributeMap();
                json = JsonMapper.ToJson(attributeMap);
            }
            catch
            {
                json = null;
            }

            if (string.IsNullOrEmpty(json))
                return;

            // Perform write
            lock (generalLock)
            {
                if (EnsureWriter())
                {
                    writer.WriteLine(json);
                }
            }
        }