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

Log() private method

private Log ( TraceEventCache eventCache, string source, TraceEventType eventType, int eventId ) : void
eventCache System.Diagnostics.TraceEventCache
source string
eventType TraceEventType
eventId int
return void
        private void Log(TraceEventCache eventCache, string source, TraceEventType eventType, int eventId, params object[] data)
        {
            if (!IsEnabled) return;

            Document doc = new Document();

            // Populate event data
            doc[ATTRIBUTE_CALLSTACK] = LimitLength(eventCache.Callstack);
            doc[ATTRIBUTE_PROCESSID] = eventCache.ProcessId;
            doc[ATTRIBUTE_THREADID] = eventCache.ThreadId;
            doc[ATTRIBUTE_HOST] = LimitLength(host);
            doc[ATTRIBUTE_SOURCE] = LimitLength(source);
            doc[ATTRIBUTE_EVENTTYPE] = eventType.ToString();
            doc[ATTRIBUTE_EVENTID] = eventId;
            doc[ATTRIBUTE_TIME] = GetCurrentTimestamp();

            // Set the message
            if (data != null && data.Length > 0)
            {
                string message = ComposeMessage(data);
                doc[ATTRIBUTE_MESSAGE] = LimitLength(message);
            }

            // Set hash/range keys, possibly from event data
            doc[ATTRIBUTE_ORIGIN] = ExpandVariables(Configuration.HashKeyFormat, doc);
            doc[ATTRIBUTE_TIMESTAMP] = ExpandVariables(Configuration.RangeKeyFormat, doc);

            // Remove attributes that should be excluded
            if (Configuration.ExcludeAttributes != null)
            {
                foreach (string exclude in Configuration.ExcludeAttributes)
                {
                    doc[exclude] = null;
                }
            }

            // Add message to documents list
            AppendDocument(doc);
        }