Exemplo n.º 1
0
        public static ChoLogEntry New(string message)
        {
            ChoLogEntry logEntry = new ChoLogEntry();

            logEntry.Message = message;

            return(logEntry);
        }
Exemplo n.º 2
0
        public static ChoLogEntry New(string[] categories, string message)
        {
            ChoLogEntry logEntry = new ChoLogEntry();

            logEntry.Categories = categories;
            logEntry.Message    = message;

            return(logEntry);
        }
Exemplo n.º 3
0
        public static void Log(object message, ICollection <string> categories, TraceEventType severity, int eventId, IDictionary <string, object> additionalProperties)
        {
            ChoLogEntry logEntry = ChoObjectManagementFactory.CreateInstance <ChoLogEntry>(typeof(ChoLogEntry));

            logEntry.AdditionalProperties = additionalProperties;
            logEntry.Categories           = categories;
            logEntry.Message  = message.ToString();
            logEntry.Severity = severity;
            logEntry.EventId  = eventId;

            Log(logEntry);
        }
Exemplo n.º 4
0
        public string Format(ChoLogEntry logMessage)
        {
            StringBuilder msg = new StringBuilder(template);

            msg.Replace(timeStampToken, logMessage.TimeStamp.ToShortDateString());
            msg.Replace(messageToken, logMessage.Message);
            msg.Replace(severityToken, logMessage.Severity.ToString());

            msg.Replace(NewLineToken, Environment.NewLine);
            msg.Replace(TabToken, "\t");

            return(msg.ToString());
        }
Exemplo n.º 5
0
        public void Log(ChoLogEntry message)
        {
            ChoDictionary <string, ChoLogListener[]> logListeners = ChoLoggerSettings.Me.Find(message.Categories);

            foreach (string key in logListeners.Keys)
            {
                if (logListeners[key] != null)
                {
                    foreach (ChoLogListener logListener in logListeners[key])
                    {
                        logListener.TraceData(new TraceEventCache(), key, message.Severity, 100, message.Message);
                    }
                }
            }
        }
Exemplo n.º 6
0
        public object Clone()
        {
            ChoLogEntry logEntry = new ChoLogEntry();

            logEntry.Message    = Message;
            logEntry.Severity   = Severity;
            logEntry.Categories = new List <string>(Categories);

            // clone extended properties
            if (_additionalProperties != null)
            {
                logEntry.AdditionalProperties = new Dictionary <string, object>(_additionalProperties);
            }

            return(logEntry);
        }
Exemplo n.º 7
0
 public static void Log(ChoLogEntry log)
 {
     Log(ChoStackTrace.GetStackFrame(typeof(ChoLogger)), log);
 }