コード例 #1
0
ファイル: Logger.cs プロジェクト: AnonymousDeviser/bukkitgui2
        /// <summary>
        ///     Log a message to the logger
        /// </summary>
        /// <param name="level">Indicates how severe the message is. </param>
        /// <param name="origin">The class that called the log() command</param>
        /// <param name="message">The message to log</param>
        /// <param name="details">optional details, for example the message of an exception</param>
        public static void Log(LogLevel level, string origin, string message, string details = "")
        {
            LogEntry entry = new LogEntry(level, origin, message, details, TimeStamp());
            Debug.WriteLine(entry.ToString());

            //if initialized, also log to file
            if (IsInitialized)
            {
                _entries.Add(entry);
            }
        }
コード例 #2
0
ファイル: Logger.cs プロジェクト: CaptainTF/bukkitgui2
		/// <summary>
		///     Log a message to the logger
		/// </summary>
		/// <param name="level">Indicates how severe the message is. </param>
		/// <param name="origin">The class that called the log() command</param>
		/// <param name="message">The message to log</param>
		/// <param name="details">optional details, for example the message of an exception</param>
		public static void Log(LogLevel level, string origin, string message, string details = "")
		{
			LogEntry entry = new LogEntry(level, origin, message, details, TimeStamp());
			Debug.WriteLine(entry.ToString());

			//if initialized, also log to file
			if (IsInitialized)
			{
				try
				{
					_entries.Add(entry);
				}
				catch (Exception ignored)
				{
					// ignored
				}

				if (_entries.Count > 512) SaveFile();
			}
		}