Beispiel #1
0
        public string format(logRecord record_in)
        {
            StringBuilder b = new StringBuilder();

            record_in.message = record_in.getMessage();

            object[] formatArgs = getStringFormatObjects(record_in);
            return(String.Format(formatString, formatArgs));
        }
Beispiel #2
0
        private object[] getStringFormatObjects(logRecord record_in)
        {
            List <object> tempObjArray = new List <object>();

            foreach (string attr in formatList)
            {
                tempObjArray.Add(record_in.attributes[attr]);
            }
            return(tempObjArray.ToArray());
        }
Beispiel #3
0
 public void handle(logRecord record_in)
 {
     //TODO: add unit test to check that we properly eat messages when no handler is present
     if (this.handlerList.Count == 0)
     {
         return;
     }
     foreach (baseHandler h in this.handlerList)
     {
         h.log(record_in);
     }
 }
Beispiel #4
0
        private void executeLog(loggerLevels methodLevel, string message_in, object[] args, string _func, string _pathname, long _lineno)
        {
            if (!string.IsNullOrWhiteSpace(_message_template))
            {
                string conformedMessage_template = _message_template;
                if (conformedMessage_template.Contains("{message}"))
                {
                    conformedMessage_template = conformedMessage_template.Replace("{message}", "{0}");
                }

                if (!conformedMessage_template.Contains("{0}"))
                {
                    conformedMessage_template = $"{conformedMessage_template} {{0}}";
                }

                message_in = string.Format(conformedMessage_template, message_in);
            }
            logRecord record = new logRecord(_name, methodLevel, message_in, args, null, _func, _pathname, _lineno);

            handle(record);
        }
Beispiel #5
0
 public string formatTime(logRecord record_in, string dateFormat = null)
 {
     return("");
 }
Beispiel #6
0
 private void callHandler(logRecord record)
 {
 }