Clone in a terminal:
Commit b8ac437
Johan Mattsson - 2013-09-10T07:44:55+00:00
b8ac4378963f42fed848ac02686a3fd79abfc0ddjohan.mattsson.m@gmail.com

log export to file

Changed files (7)

Diff

diff --git a/configure b/configureindex 7152cb2..d7f6722 100755--- a/configure+++ b/configure@@ -54,7 +54,7 @@ def configure (): 	libs = [ 			'cairo',  			'gdk-pixbuf-2.0', -			'gee-1.0',+			'gee-0.8', 			'gio-2.0',  			'glib-2.0',  			'gtk+-2.0',diff --git a/libbirdfont/BirdFont.vala b/libbirdfont/BirdFont.valaindex a341fb2..0ffb08a 100644--- a/libbirdfont/BirdFont.vala+++ b/libbirdfont/BirdFont.vala@@ -43,6 +43,8 @@ public static int run_export (string[] arg) { 		return -1; 	} 	+	init_logfile ();+	 	for (int i = 1; i < arg.length; i++) {  		if (arg[i] == "-f" || arg[i] == "--fatal-warnings") {@@ -183,6 +185,9 @@ public class BirdFont { 	public static string exec_path = ""; 	public static string bundle_path = ""; +	public static bool logging = false;+	public static DataOutputStream? logstream = null;+ 	public static Font current_font; 	public static Glyph current_glyph; 	@@ -363,4 +368,51 @@ public class BirdFont { 	}	 } +void init_logfile () {+	DateTime t;+	File settings;+	string s;+	+	LogLevelFlags levels = LogLevelFlags.LEVEL_ERROR | LogLevelFlags.LEVEL_CRITICAL | LogLevelFlags.LEVEL_WARNING | LogLevelFlags.LEVEL_DEBUG;+	Log.set_handler (null, levels, log_warning);		+		+	try {+		t = new DateTime.now_local ();+		settings = BirdFont.get_settings_directory ();+		s = t.to_string ();+		File log = settings.get_child (@"birdfont_$s.log"); +		BirdFont.logstream = new DataOutputStream (log.create (FileCreateFlags.REPLACE_DESTINATION));+	} catch (GLib.Error e) {+		warning (e.message);+	}+	+	BirdFont.logging = true;+}++internal static void log_warning (string? log_domain, LogLevelFlags log_levels, string message) {+	if (log_domain != null) {+		printd ((!) log_domain);+	}+	+	printd ("\n");+	printd (message);+	printd ("\n");+	printd ("\n");+}++/** Write debug output to logfile. */+void printd (string s) {+	if (unlikely (BirdFont.logging)) {+		try {+			if (BirdFont.logstream != null) {+				((!)BirdFont.logstream).put_string (s);+			} else {+				warning ("No logstream.");+			}+		} catch (GLib.Error e) {+			warning (e.message);+		}+	}+}+ }diff --git a/libbirdfont/BirdFontFile.vala b/libbirdfont/BirdFontFile.valaindex b26b771..e1a5339 100644--- a/libbirdfont/BirdFontFile.vala+++ b/libbirdfont/BirdFontFile.vala@@ -36,7 +36,9 @@ class BirdFontFile { 		Xml.Node* root; 		 		Parser.init ();-+		+		printd (@"Loading $path\n");+		 		font.font_file = path; // this will be updated if we are loading a backup file  		doc = Parser.parse_file (path);@@ -464,7 +466,10 @@ class BirdFontFile { 		Xml.Node* node = root; 		 		for (Xml.Node* iter = node->children; iter != null; iter = iter->next) {-+			+			printd (iter->name); // FIXME: delete+			printd ("\n");+	 			// this is a backup file set path to the original  			if (iter->name == "backup") { 				font.font_file = iter->children->content;@@ -498,6 +503,15 @@ class BirdFontFile {  			if (iter->name == "postscript_name" && iter->children != null) { 				font.postscript_name = iter->children->content;+				+				printd ("PostScript name:"); // FIXME: delete when debugging is done+				printd (iter->children->content);+				printd ("\n");+			}+			+			// FIXME: delete when debugging is done+			if (iter->name == "postscript_name" && iter->children == null) {+				printd ("Found PostScipt name but content for this node is null in libxml.\n"); 			} 			 			if (iter->name == "name" && iter->children != null) {diff --git a/libbirdfont/Font.vala b/libbirdfont/Font.valaindex e4e78f7..7d2be8b 100644--- a/libbirdfont/Font.vala+++ b/libbirdfont/Font.vala@@ -333,6 +333,8 @@ public class Font : GLib.Object { 		} 		 		glyph_cache.insert (glyph_collection.get_unicode (), glyph_collection);+		+		printd (@"Adding $(glyph_collection.get_current ().get_name ())\n"); 	} 	 	public string get_name_for_character (unichar c) {diff --git a/libbirdfont/MoveTool.vala b/libbirdfont/MoveTool.valaindex 25563de..e4ef23a 100644--- a/libbirdfont/MoveTool.vala+++ b/libbirdfont/MoveTool.vala@@ -64,8 +64,6 @@ class MoveTool : Tool { 	}  	public static void draw_actions (Context cr) {-		Glyph g = MainWindow.get_current_glyph ();-		 		if (group_selection) { 			draw_selection_box (cr); 		}diff --git a/libbirdfont/OpenFontFormat/OpenFontFormatWriter.vala b/libbirdfont/OpenFontFormat/OpenFontFormatWriter.valaindex 4e589b3..350a93e 100644--- a/libbirdfont/OpenFontFormat/OpenFontFormatWriter.vala+++ b/libbirdfont/OpenFontFormat/OpenFontFormatWriter.vala@@ -75,8 +75,4 @@ class OpenFontFormatWriter : Object  { 	} } -void printd (string s) {-	//print (s);-}- }diff --git a/libbirdfont/ResizeTool.vala b/libbirdfont/ResizeTool.valaindex 303dc5b..0f49a5f 100644--- a/libbirdfont/ResizeTool.vala+++ b/libbirdfont/ResizeTool.vala@@ -207,13 +207,6 @@ class ResizeTool : Tool { 					 		cr.restore ();				 	}-	-	static void update_selection_boundries () {-		MoveTool.update_boundries_for_selection ();-		MoveTool.get_selection_box_boundries (out selection_box_center_x,-			out selection_box_center_y, out selection_box_width,-			out selection_box_height);	-	}  	double get_resize_ratio (double x, double y) { 		double ratio;

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112