[gnome-builder/1151-vala-pass-dependencies-to-lsp: 14/14] Use Ide logging facilities



commit af89379b09c74e9ba59bd635a3454efbcff81e2f
Author: Alberto Fanjul <albertofanjul gmail com>
Date:   Tue Mar 24 22:19:58 2020 +0100

    Use Ide logging facilities

 src/plugins/gvls/gvls_plugin.py | 48 +++++++++++------------------------------
 1 file changed, 13 insertions(+), 35 deletions(-)
---
diff --git a/src/plugins/gvls/gvls_plugin.py b/src/plugins/gvls/gvls_plugin.py
index 9d3f3392b..123e78f50 100644
--- a/src/plugins/gvls/gvls_plugin.py
+++ b/src/plugins/gvls/gvls_plugin.py
@@ -83,7 +83,7 @@ class GVlsService(Ide.Object):
         GVlsService.
         """
         if self._client is not None:
-            print ("Shutting down server")
+            Ide.warning ("Shutting down server")
             self._client.stop()
             self._client.destroy()
 
@@ -192,10 +192,9 @@ class GVlsService(Ide.Object):
             fdi = GLib.Variant.new_dict_entry(fd, GLib.Variant.new_variant (vfdi))
             b.add_value(fdi)
             return GLib.Variant.new_variant (b.end())
-        except:
-            print ('>>>>>>>>>>>>>>>> On Load Configuration Error:\n\n\n')
+        except Error as e:
+            Ide.debug ('On Load Configuration Error: {}'.format(e.message))
             return GLib.Variant ('a{sv}', {})
-            print('\n\n\n')
     
     def _build_config_changed(self, obj, mfile, ofile, event_type):
         if event_type == Gio.FileMonitorEvent.CHANGED or event_type == Gio.FileMonitorEvent.CREATED:
@@ -341,17 +340,13 @@ class GVlsService(Ide.Object):
                     arg_name = s
                     continue
         except BaseException as exc:
-            print('\n\nParse Build Commands Error:\n')
-            print(exc.args)
-            print('\n\n\n')
+            Ide.debug('Parse Build Commands Error: {}'.format(exc.args))
 
     def _did_change_configuration(self, source_object, result, user_data):
         try:
             self._client.send_notification_finish(result)
         except BaseException as exc:
-            print('\n\nChange Configuration Notification error:\n')
-            print(exc.args)
-            print('\n\n\n')
+            Ide.debug('Change Configuration Notification error: {}'.format(exc.args))
     
     def _notify_change_configuration(self):
         try:
@@ -365,9 +360,7 @@ class GVlsService(Ide.Object):
             vnotify = GLib.Variant.new_variant(b.end())
             self._client.send_notification_async("workspace/didChangeConfiguration", vnotify, cancellable, 
self._did_change_configuration, None)
         except BaseException as exc:
-            print('\n\nNotify change configuration error:\n')
-            print(exc.args)
-            print('\n\n\n')
+            Ide.debug('Notify change configuration error: {}'.format(exc.args))
     
     def _on_load_configuration(self, data):
         ctx = self._client.get_context()
@@ -385,9 +378,7 @@ class GVlsService(Ide.Object):
         try:
             self.source_file = diagnostic.get_file()
         except BaseException as exc:
-            print('\n\nOn Pipeline Loaded start get build flags error:\n')
-            print(exc.args)
-            print('\n\n\n')
+            Ide.debug('On Pipeline Loaded start get build flags error: {}'.format(exc.args))
 
     def on_get_vala_data_dir(self, vdp, cancellable, data):
         try:
@@ -403,9 +394,7 @@ class GVlsService(Ide.Object):
             rtfgdvapi = rt.translate_file(fgdvapi)
             self.system_vapidir = rtfgdvapi.get_uri() + "/vala/vapi"
         except BaseException as exc:
-            print('\n\nOn get Vala DATA VAPI DIR:\n')
-            print(str(exc))
-            print('\n\n\n')
+            Ide.debug('On get Vala DATA VAPI DIR: {}'.format(str(exc)))
     
     def on_get_vapidir(self, vpkgp, cancellable, data):
         try:
@@ -430,9 +419,7 @@ class GVlsService(Ide.Object):
             vdp = launcher.spawn(None)
             vdp.wait_async(None, self.on_get_vala_data_dir, None)
         except BaseException as exc:
-            print('\n\nOn get Vala VAPI DIR:\n')
-            print(str(exc))
-            print('\n\n\n')
+            Ide.debug('On get Vala VAPI DIR: {}'.format(str(exc)))
     
     def on_get_vala_api_version(self, valacp, cancellable, data):
         try:
@@ -455,9 +442,7 @@ class GVlsService(Ide.Object):
             vpkgp = launcher.spawn(None)
             vpkgp.wait_async(None, self.on_get_vapidir, None)
         except BaseException as exc:
-            print('\n\nOn get Vala API VERSION Runtime Configuration:\n')
-            print(str(exc))
-            print('\n\n\n')
+            Ide.debug('On get Vala API VERSION Runtime Configuration: {}'.format(str(exc)))
     
     def _update_config_from_runtime(self):
         try:
@@ -476,9 +461,7 @@ class GVlsService(Ide.Object):
             valacp = launcher.spawn(None)
             valacp.wait_async(None, self.on_get_vala_api_version, None)
         except BaseException as exc:
-            print('\n\nOn Update Runtime Configuration:\n')
-            print(str(exc))
-            print('\n\n\n')
+            Ide.debug('On Update Runtime Configuration: {}'.format(str(exc)))
     
     def on_config_changed_cb(self, data):
         try:
@@ -487,9 +470,7 @@ class GVlsService(Ide.Object):
             self.pipeline = buildmgr.get_pipeline ()
             self.pipeline.connect('diagnostic', self._on_pipeline_diagnostic)
         except BaseException as exc:
-            print('\n\nOn Config Changed CB:\n')
-            print(str(exc))
-            print('\n\n\n')
+            Ide.debug('On Config Changed CB: {}'.format(str(exc)))
 
     def _gvls_spawned(self, supervisor, subprocess):
         """
@@ -525,10 +506,7 @@ class GVlsService(Ide.Object):
             cfgmgr.connect('notify::current', self.on_config_changed_cb)
             self._update_config_from_runtime()
         except BaseException as exc:
-            print('\n\n\n Exception Arguments: \n')
-            print(exc.args)
-            print('\n\n')
-            
+            Ide.debug('Exception Arguments: {}'.format(exc.args))
 
     def _create_launcher(self):
         """


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]