Пример #1
0
            private static string FormatLogEntry(LogEntry entry, bool includeKeyValues = false)
            {
                StringBuilder entryText = new StringBuilder();

                if (!string.IsNullOrWhiteSpace(entry.loggerName))
                {
                    entryText.AppendFormat("{0} - ", entry.loggerName);
                }

                entryText.Append(entry.message);
                entryText.AppendFormat(" ({0})", LogFilters.GetFilterString(entry.filter.Flags));

                if (entry.errorCode != 0)
                {
                    entryText.AppendFormat(" - error code {0}", entry.errorCode);
                }

                if (!string.IsNullOrWhiteSpace(entry.location))
                {
                    entryText.AppendFormat(" @ {0}", entry.location);
                }

                if (includeKeyValues && entry.keyValues.Count > 0)
                {
                    entryText.AppendLine();
                    entryText.AppendFormat("Key Values = {0}", entry.keyValues.JoinKeyValuePairs());
                }

                return(entryText.ToString());
            }
Пример #2
0
            private static string FormatLogEntry(LogEntry entry)
            {
                StringBuilder entryText = new StringBuilder();

                entryText.Append(entry.message);
                entryText.AppendFormat(" ({0})", LogFilters.GetFilterString(entry.filter.Flags));

                if (!string.IsNullOrWhiteSpace(entry.location))
                {
                    entryText.AppendFormat(" @ {0}", entry.location);
                }

                return(entryText.ToString());
            }
Пример #3
0
        void ILogHandler.Log(LogEntry entry)
        {
            var hint = GetDisplayHint(entry.filter);

            if (DisplayTimestamp(entry.filter))
            {
                proxy.Log(hint, "");
                proxy.LogFull(hint, LogFilters.GetFilterString(entry.filter.Flags), entry.alias, entry.message);
            }
            else
            {
                proxy.Log(hint, entry.message);
            }
        }