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)); }
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()); }
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); } }
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); }
public string formatTime(logRecord record_in, string dateFormat = null) { return(""); }
private void callHandler(logRecord record) { }