Просмотр исходного кода

tools: do not print log severity to Console

Daniele Bartolini 4 лет назад
Родитель
Сommit
aa5e1ae0b7
2 измененных файлов с 18 добавлено и 6 удалено
  1. 1 0
      docs/changelog.rst
  2. 17 6
      tools/level_editor/level_editor.vala

+ 1 - 0
docs/changelog.rst

@@ -8,6 +8,7 @@ Changelog
 **Tools**
 
 * Fixed Engine View not redrawing when a command was sent from the Console.
+* Various fixes and improvements to the Console.
 
 0.43.0
 ------

+ 17 - 6
tools/level_editor/level_editor.vala

@@ -2397,21 +2397,32 @@ public static bool _console_view_valid = false;
 public static void log(string system, string severity, string message)
 {
 	GLib.DateTime now = new GLib.DateTime.now_utc();
-	string line = "%s.%06d  %.4s %s: %s\n".printf(now.format("%H:%M:%S")
-		, now.get_microsecond()
-		, severity.ascii_up()
-		, system
-		, message
-		);
+	int now_us = now.get_microsecond();
+	string now_str = now.format("%H:%M:%S");
 
 	if (_log_stream != null)
 	{
+		string line = "%s.%06d  %.4s %s: %s\n".printf(now_str
+			, now_us
+			, severity.ascii_up()
+			, system
+			, message
+			);
+
 		_log_stream.puts(line);
 		_log_stream.flush();
 	}
 
 	if (_console_view_valid)
+	{
+		string line = "%s.%06d  %s: %s\n".printf(now_str
+			, now_us
+			, system
+			, message
+			);
+
 		_console_view.log(severity, line);
+	}
 }
 
 public static void logi(string message)