private void WriteToLog(string level, string format, params object[] values)
{
if (TraceSource.Switch.Level == SourceLevels.Off)
{
return;
}
for (int i = 0; i < values.Length; i++)
{
if (values[i] != null)
{
if (values[i].GetType() == typeof(CallfireModel))
{
values[i] = Serializer.Serialize(values[i]);
}
else if (values[i] is ICollection)
{
values[i] = (((ICollection)values[i]).Cast<object>().ToList().ToPrettyString());
}
}
}
CallfireLogFile.WriteLine(string.Format("{0} - {1} [{2}] {3}", DateTime.Now.ToString(ClientConstants.LOG_DATETIME_PATTERN),
TraceSource.Name, level, string.Format(format, values)));
}