efl_mono: move Eina.Log.Init to class consturctor
authorMarcel Hollerbach <mail@marcel-hollerbach.de>
Wed, 16 Jan 2019 12:47:09 +0000 (13:47 +0100)
committerJunsuChoi <jsuya.choi@samsung.com>
Thu, 24 Jan 2019 05:20:17 +0000 (14:20 +0900)
Summary:
This removes the need to explicitly init the log class.
Depends on D7495

Reviewers: felipealmeida, lauromoura, segfaultxavi

Reviewed By: felipealmeida, segfaultxavi

Subscribers: segfaultxavi, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7555

src/bindings/mono/eina_mono/eina_config.cs
src/bindings/mono/eina_mono/eina_log.cs
src/tests/efl_mono/Eina.cs

index 6bc0397..87cedaf 100644 (file)
@@ -14,7 +14,6 @@ public class Config {
             throw (new Efl.EflException("Failed to initialize Eina"));
 
         // Initialize the submodules here
-        Eina.Log.Init();
         Eina.Error.Init();
     }
 
index 855c0f3..c17f02b 100644 (file)
@@ -53,22 +53,17 @@ public class Log
 
     private static int domain = -1;
 
-    internal static void Init(String name="mono", String color="\033[32;1m")
+    static Log()
     {
-        if (domain == -1)
-          {
-              // Maybe move this check outside when other eina stuff get support?
-              domain = eina_log_domain_register(name, color);
-              if (domain < 0)
-                Console.WriteLine("Error: Couldn't register Eina log domain for name {0}.", name);
-              else
-                Info($"Registered mono domain with number {domain}");
-          }
+        const String name="mono";
+        const String color="\033[32;1m";
+
+        // Maybe move this check outside when other eina stuff get support?
+        domain = eina_log_domain_register(name, color);
+        if (domain < 0)
+          Console.WriteLine("Error: Couldn't register Eina log domain for name {0}.", name);
         else
-          {
-              Warning("Trying to initialize the log system again.");
-              // TODO Export the domain registration to the binding user to allow custom domains.
-          }
+          Info($"Registered mono domain with number {domain}");
     }
 
     private static void EnsureDomainRegistered()
index db42b23..51e37f6 100644 (file)
@@ -4047,5 +4047,12 @@ class TestEinaAccessor
     }
 }
 
+class TestEinaLog
+{
+    public static void basic_log_usage()
+    {
+        Eina.Log.Error("This should work");
+    }
+}
 
 }