private static void Log(object sender, PusherLogEventArgs e) { var text = e.Message; foreach (object o in e.Additional) { if (o == null) continue; text += " | "; if (o is JsonData) { text += Pusher.JSON.stringify(o); } else text += o.ToString(); } Console.WriteLine(text); }
void Pusher_OnLog(object sender, PusherLogEventArgs e) { if (textBoxConsole.InvokeRequired) { textBoxConsole.Invoke((Action)(() => Pusher_OnLog(sender, e))); return; } textBoxConsole.Text += e.Message; foreach (object obj in e.Additional) { textBoxConsole.Text += " | "; if (obj is JsonData) textBoxConsole.Text += Pusher.JSON.stringify(obj); else textBoxConsole.Text += obj == null ? "null" : obj.ToString(); } textBoxConsole.Text += Environment.NewLine; textBoxConsole.Select(textBoxConsole.Text.Length, 0); }
private void Pusher_OnLog(object sender, PusherLogEventArgs e) { StringBuilder msg = new StringBuilder(); msg.AppendLine( e.Message ); foreach (object obj in e.Additional) { if (obj is JsonData) msg.AppendLine(Pusher.JSON.stringify(obj)); else msg.AppendLine(obj == null ? "null" : obj.ToString()); } Log(msg.ToString()); }