Exemple #1
0
        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);
     }
 }
Exemple #3
0
 /// <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);
     }
 }
Exemple #4
0
 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);
     }
 }
Exemple #6
0
        /// <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;
            }
        }
Exemple #7
0
        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);
        }
Exemple #8
0
        /// <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;
            }
        }
Exemple #9
0
 //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 {; }
 }
Exemple #10
0
        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);
            }
        }
Exemple #11
0
        /// <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);
                }
            }
        }
Exemple #12
0
 /// <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);
 }
Exemple #13
0
 void client_OnLogMessage(string message, Helpers.LogLevel level)
 {
     Log("libsl: " + level.ToString() + ": " + message);
 }
Exemple #14
0
 /// <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);
 }
Exemple #15
0
 public static void Log(string message, Helpers.LogLevel Level, Exception exception)
 {
     Log(message, Level, null, exception);
 }
Exemple #16
0
 public static void Log(string message, Helpers.LogLevel Level, GridClient client)
 {
     Log(message, Level, null, null);
 }
Exemple #17
0
 public static void Log(string message, Helpers.LogLevel Level)
 {
     Log(message, Level, null, null);
 }
Exemple #18
0
 public static void LogFormat(string Message, Helpers.LogLevel Level, string[] Values)
 {
     Log(String.Format(Message, Values), Level);
 }
Exemple #19
0
 /// <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);
 }
Exemple #21
0
 public DebugLogMessage(string message, Helpers.LogLevel level)
 {
     this.message = message;
     this.level = level;
 }
Exemple #22
0
 /// <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;
 }
Exemple #24
0
 /// <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);
 }
Exemple #25
0
 /// <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);
 }
Exemple #26
0
 public static void LogFormat(string Message, Helpers.LogLevel Level, int Value)
 {
     LogFormat(Message, new[] { Value.ToString() });
 }
Exemple #27
0
 public DebugLogMessage(string message, Helpers.LogLevel level, DateTime tstamp)
 {
     this.message   = message;
     this.level     = level;
     this.timestamp = tstamp;
 }