logging functions bugfix

Signed-off-by: eantwuh <antal.wu-hen-chang@ericsson.com>
diff --git a/IOT_LGen_Definitions.ttcn b/IOT_LGen_Definitions.ttcn
index 1bed90d..823c167 100644
--- a/IOT_LGen_Definitions.ttcn
+++ b/IOT_LGen_Definitions.ttcn
@@ -71,6 +71,9 @@
   import from EPTF_CLL_ExecCtrl_Definitions all;
   import from InfluxDB_Definitions all;
 
+  modulepar boolean tsp_IOT_LGen_debug := false;
+  modulepar boolean tsp_IOT_LGen_debugVerbose := false;
+
   ///////////////////////////////////////////////////////////
   //  Module parameter: tsp_IOT_LGen_FSMs
   // 
diff --git a/IOT_LGen_Functions.ttcn b/IOT_LGen_Functions.ttcn
index 0a31c6f..b4514b4 100644
--- a/IOT_LGen_Functions.ttcn
+++ b/IOT_LGen_Functions.ttcn
@@ -136,13 +136,7 @@
     v_IOT_LGen_name := pl_selfName;
     v_IOT_LGen_idx := p_idx;
 
-    f_EPTF_Logging_init_CT(pl_selfName);
-
-    v_IOT_LGen_loggingMaskId := 
-      f_EPTF_Logging_registerComponentMasks(
-        "IOT_LGen", 
-        {"WARNING", "DEBUG", "DEBUGV" ,"ERROR" },
-        EPTF_Logging_CLL);    
+    f_IOT_LGen_initLogging(pl_selfName);
 
     f_EPTF_LGenBase_init(pl_selfName, 0, "IoT_Entity#");
 
@@ -226,6 +220,32 @@
     f_EPTF_LGenBase_declareFSMTables(tsp_IOT_LGen_FSMs);
   }
 
+  function f_IOT_LGen_initLogging(in charstring p_selfName)
+  runs on IOT_LGen_CT
+  {
+    f_EPTF_Logging_init_CT(p_selfName);
+    v_IOT_LGen_loggingMaskId := 
+    	f_EPTF_Logging_registerComponentMasks(
+    		"IOT_LGen_Logging", 
+    		{"WARNING", "DEBUG", "DEBUGV", "ERROR"}, 
+    		EPTF_Logging_CLL
+    	);
+    	
+	if(tsp_IOT_LGen_debug){
+	  f_EPTF_Logging_enableLocalMask(v_IOT_LGen_loggingMaskId, c_IOT_LGen_Logging_DEBUG);
+	}
+	else {
+	  f_EPTF_Logging_disableLocalMask(v_IOT_LGen_loggingMaskId, c_IOT_LGen_Logging_DEBUG);
+	}
+
+	if(tsp_IOT_LGen_debugVerbose) {
+	  f_EPTF_Logging_enableLocalMask(v_IOT_LGen_loggingMaskId, c_IOT_LGen_Logging_DEBUGV);
+	}
+	else {
+	  f_EPTF_Logging_disableLocalMask(v_IOT_LGen_loggingMaskId, c_IOT_LGen_Logging_DEBUGV);
+	} 
+  }
+
   ///////////////////////////////////////////////////////////
   //  Function: f_IOT_LGen_Logging_VERBOSE
   //
diff --git a/IOT_LGen_Steps.ttcn b/IOT_LGen_Steps.ttcn
index 23de1c7..70f91a8 100644
--- a/IOT_LGen_Steps.ttcn
+++ b/IOT_LGen_Steps.ttcn
@@ -15,23 +15,6 @@
 //  Contact:            http://ttcn.ericsson.se
 ///////////////////////////////////////////////////////////////////////////////
 
-///////////////////////////////////////////////////////////////////////////////
-//
-// Copyright (c) 2000-2019 Ericsson Telecom AB
-//
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v2.0
-// which accompanies this distribution, and is available at
-// https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
-///////////////////////////////////////////////////////////////////////////////
-//  File:               IOT_LGen_Functions.ttcn
-//  Description:
-//  Rev:                R1A
-//  Prodnr:             LPA 108 661
-//  Updated:            2017-09-01
-//  Contact:            http://ttcn.ericsson.se
-///////////////////////////////////////////////////////////////////////////////
-
 ///////////////////////////////////////////////////////////
 //  Module: IOT_LGen_Steps
 //