public static void Log(string message, Helpers.LogLevel Level, GridClient client, Exception exception) { if (Settings.LOG_LEVEL >= Level) { StringBuilder NewMessage = new StringBuilder(); if (client != null) { if (client.Settings.LOG_NAMES) { NewMessage.Append("{"); NewMessage.Append(client.Self.Name); NewMessage.Append("} "); } } NewMessage.Append(message); switch (Settings.LOG_WRITER) { case "NoLogWriter": { break; } default: { ConsoleWriter.LogMessage(NewMessage, Level); break; } } } }
static void Client_OnLogMessage(object message, Helpers.LogLevel level) { if (level >= Helpers.LogLevel.Warning) { Console.WriteLine(level + ": " + message); } }
/// <summary> /// Send a log message to the debugging output system /// </summary> /// <param name="message">The log message</param> /// <param name="level">From the LogLevel enum, either Info, Warning, or Error</param> public void Log(string message, Helpers.LogLevel level) { if (Debug) { Console.WriteLine(level.ToString() + ": " + message); } }
static void client_OnLogMessage(string message, Helpers.LogLevel level) { if (level == Helpers.LogLevel.Warning || level == Helpers.LogLevel.Error) { Console.WriteLine(level.ToString() + ": " + message); } }
/// <summary> /// Send a log message to the debugging output system /// </summary> /// <param name="message">The log message</param> /// <param name="level">From the LogLevel enum, either Info, Warning, or Error</param> public void Log(string message, Helpers.LogLevel level) { if (OnLogMessage != null) { OnLogMessage(message, level); } else { Console.WriteLine(level.ToString().ToUpper() + ": " + message); } }
/// <summary> /// Send a log message to the logging engine /// </summary> /// <param name="message">The log message</param> /// <param name="level">The severity of the log entry</param> /// <param name="client">Instance of the client</param> /// <param name="exception">Exception that was raised</param> public static void Log(object message, Helpers.LogLevel level, GridClient client, Exception exception) { if (client != null && client.Settings.LOG_NAMES) { message = String.Format("<{0}>: {1}", client.Self.Name, message); } if (OnLogMessage != null) { OnLogMessage(message, level); } switch (level) { case Helpers.LogLevel.Debug: if (Settings.LOG_LEVEL == Helpers.LogLevel.Debug) { LogInstance.Debug(message, exception); } break; case Helpers.LogLevel.Info: if (Settings.LOG_LEVEL == Helpers.LogLevel.Debug || Settings.LOG_LEVEL == Helpers.LogLevel.Info) { LogInstance.Info(message, exception); } break; case Helpers.LogLevel.Warning: if (Settings.LOG_LEVEL == Helpers.LogLevel.Debug || Settings.LOG_LEVEL == Helpers.LogLevel.Info || Settings.LOG_LEVEL == Helpers.LogLevel.Warning) { LogInstance.Warn(message, exception); } break; case Helpers.LogLevel.Error: if (Settings.LOG_LEVEL == Helpers.LogLevel.Debug || Settings.LOG_LEVEL == Helpers.LogLevel.Info || Settings.LOG_LEVEL == Helpers.LogLevel.Warning || Settings.LOG_LEVEL == Helpers.LogLevel.Error) { LogInstance.Error(message, exception); } break; default: break; } }
public static void LogMessage(StringBuilder messageBuilder, Helpers.LogLevel Level) { var date = DateTime.Now; string Message = messageBuilder.ToString(); messageBuilder.Clear(); messageBuilder.Append("["); if (date.Hour < 10) { messageBuilder.Append("0"); } messageBuilder.Append(date.Hour.ToString()); messageBuilder.Append(":"); if (date.Minute < 10) { messageBuilder.Append("0"); } messageBuilder.Append(date.Minute.ToString()); messageBuilder.Append("] "); switch (Level) { case Helpers.LogLevel.Debug: { messageBuilder.Append("Debug - "); break; } case Helpers.LogLevel.Info: { messageBuilder.Append("Status - "); break; } case Helpers.LogLevel.Warning: { messageBuilder.Append("Warn - "); break; } case Helpers.LogLevel.Error: { messageBuilder.Append("Error - "); break; } default: break; } messageBuilder.Append(Message); WriteMessage(Message); }
/// <summary> /// Send a log message to the logging engine /// </summary> /// <param name="message">The log message</param> /// <param name="level">The severity of the log entry</param> /// <param name="client">Instance of the client</param> /// <param name="exception">Exception that was raised</param> public static void Log(object message, Helpers.LogLevel level, GridClient client, Exception exception) { if (client != null && client.Settings.LOG_NAMES) { message = $"<{client.Self.Name}>: {message}"; } OnLogMessage?.Invoke(message, level); switch (level) { case Helpers.LogLevel.Debug: if (Settings.LOG_LEVEL == Helpers.LogLevel.Debug) { LogInstance.Debug(message, exception); } break; case Helpers.LogLevel.Info: if (Settings.LOG_LEVEL == Helpers.LogLevel.Debug || Settings.LOG_LEVEL == Helpers.LogLevel.Info) { LogInstance.Info(message, exception); } break; case Helpers.LogLevel.Warning: if (Settings.LOG_LEVEL == Helpers.LogLevel.Debug || Settings.LOG_LEVEL == Helpers.LogLevel.Info || Settings.LOG_LEVEL == Helpers.LogLevel.Warning) { LogInstance.Warn(message, exception); } break; case Helpers.LogLevel.Error: if (Settings.LOG_LEVEL == Helpers.LogLevel.Debug || Settings.LOG_LEVEL == Helpers.LogLevel.Info || Settings.LOG_LEVEL == Helpers.LogLevel.Warning || Settings.LOG_LEVEL == Helpers.LogLevel.Error) { LogInstance.Error(message, exception); } break; default: break; } }
//comes in on separate thread private void client_OnLogMessage(object message, Helpers.LogLevel level) { try { if (this.IsHandleCreated) { BeginInvoke(new Logger.LogCallback(ReceivedLogMessage), new object[] { message, level }); } else { initQueue.Add(new DebugLogMessage((string)message, level, DateTime.Now)); } } catch {; } }
private void ReceivedLogMessage(object message, Helpers.LogLevel level, DateTime dte) { try { RichTextBox rtb = null; switch (level) { case Helpers.LogLevel.Info: rtb = rtbInfo; break; case Helpers.LogLevel.Warning: rtb = rtbWarning; break; case Helpers.LogLevel.Error: rtb = rtbError; break; case Helpers.LogLevel.Debug: rtb = rtbDebug; break; } string msg = (string)message; if (msg.Contains("ParticipantUpdatedEvent")) { return; } rtb.AppendText("[" + dte.ToString() + "] " + msg + "\n"); } catch (Exception ex) { Logger.Log("Logger error on receiving Log message: " + ex.Message, Helpers.LogLevel.Error); } }
/// <summary> /// Send a log message to the debugging output system /// </summary> /// <param name="message">The log message</param> /// <param name="level">The severity of the log entry</param> public void Log(string message, Helpers.LogLevel level) { if (level == Helpers.LogLevel.Debug && !Settings.DEBUG) { return; } if (OnLogMessage != null) { try { OnLogMessage(message, level); } catch (Exception e) { Console.WriteLine(e.ToString()); } } else { if (Settings.LOG_NAMES) { Console.WriteLine("{0} [{1} {2}]: {3}", level.ToString().ToUpper(), Self.FirstName, Self.LastName, message); } else { Console.WriteLine("{0}: {1}", level.ToString().ToUpper(), message); } } }
/// <summary> /// Send a log message to the logging engine /// </summary> /// <param name="message">The log message</param> /// <param name="level">The severity of the log entry</param> /// <param name="exception">Exception that was raised</param> public static void Log(object message, Helpers.LogLevel level, Exception exception) { Log(message, level, null, exception); }
void client_OnLogMessage(string message, Helpers.LogLevel level) { Log("libsl: " + level.ToString() + ": " + message); }
/// <summary> /// /// </summary> /// <param name="message"></param> /// <param name="level"></param> public static void LogStatic(string message, Helpers.LogLevel level) { Console.WriteLine("{0}: {1}", level.ToString().ToUpper(), message); }
public static void Log(string message, Helpers.LogLevel Level, Exception exception) { Log(message, Level, null, exception); }
public static void Log(string message, Helpers.LogLevel Level, GridClient client) { Log(message, Level, null, null); }
public static void Log(string message, Helpers.LogLevel Level) { Log(message, Level, null, null); }
public static void LogFormat(string Message, Helpers.LogLevel Level, string[] Values) { Log(String.Format(Message, Values), Level); }
/// <summary> /// Send a log message to the logging engine /// </summary> /// <param name="message">The log message</param> /// <param name="level">The severity of the log entry</param> public static void Log(object message, Helpers.LogLevel level) { Log(message, level, null, null); }
void client_OnLogMessage(string message, Helpers.LogLevel level) { Log("libsl: " + level.ToString() + ": " + message + Environment.NewLine); }
public DebugLogMessage(string message, Helpers.LogLevel level) { this.message = message; this.level = level; }
/// <summary> /// /// </summary> /// <param name="message"></param> /// <param name="level"></param> /// <param name="exception"></param> public static void LogStatic(string message, Helpers.LogLevel level, Exception exception) { Console.WriteLine("{0} [libsecondlife]: {1} ({2})", level.ToString().ToUpper(), message, exception); }
public DebugLogMessage(string message, Helpers.LogLevel level, DateTime tstamp) { this.message = message; this.level = level; this.timestamp = tstamp; }
/// <summary> /// Send a log message to the logging engine /// </summary> /// <param name="message">The log message</param> /// <param name="level">The severity of the log entry</param> /// <param name="client">Instance of the client</param> public static void Log(object message, Helpers.LogLevel level, GridClient client) { Log(message, level, client, null); }
/// <summary> /// Send a log message to the logging engine /// </summary> /// <param name="message">The log message</param> /// <param name="level">The severity of the log entry</param> /// <param name="client">Instance of the client</param> public static void Log(object message, Helpers.LogLevel level, SecondLife client) { Log(message, level, client, null); }
public static void LogFormat(string Message, Helpers.LogLevel Level, int Value) { LogFormat(Message, new[] { Value.ToString() }); }