[fractal] fractal-gtk: Fix loggerv init with debug_assertions



commit d44e4396383036dd8f4bc7b9bc50d7f079652d39
Author: Daniel GarcĂ­a Moreno <dani danigm net>
Date:   Mon Jun 29 10:26:11 2020 +0200

    fractal-gtk: Fix loggerv init with debug_assertions
    
    This patch is a quick fix for the regression introduced in this commit:
    146df508d3b09774e1ab16e7ab438caf5206c1e4
    
    The loggerv init method should be called just once, and it's different
    depending on the debug_assertions flag.

 fractal-gtk/src/main.rs | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/fractal-gtk/src/main.rs b/fractal-gtk/src/main.rs
index bbc896de..61382633 100644
--- a/fractal-gtk/src/main.rs
+++ b/fractal-gtk/src/main.rs
@@ -40,15 +40,20 @@ fn main() -> Result<(), Box<dyn Error>> {
         );
 
     let clap_args = clap_app.get_matches();
-    loggerv::init_with_verbosity(clap_args.occurrences_of("v"))
-        .expect("Failed to initialize logger");
-
     #[cfg(debug_assertions)]
     {
         if clap_args.occurrences_of("v") == 0 {
             loggerv::init_with_level(Level::Info).expect("Failed to initialize logger");
+        } else {
+            loggerv::init_with_verbosity(clap_args.occurrences_of("v"))
+                .expect("Failed to initialize logger");
         }
     }
+    #[cfg(not(debug_assertions))]
+    {
+        loggerv::init_with_verbosity(clap_args.occurrences_of("v"))
+            .expect("Failed to initialize logger");
+    }
 
     static_resources::init().expect("GResource initialization failed.");
 


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