Replace print with logging

 * redirect logging to stdout

Related-Prod: PRODX-0000
Change-Id: I633908f25221c0b072c510e11b33c9ea1f99aeb2
diff --git a/de/heat-templates/scripts/prepare-metadata.py b/de/heat-templates/scripts/prepare-metadata.py
index 70924ca..2ad0077 100644
--- a/de/heat-templates/scripts/prepare-metadata.py
+++ b/de/heat-templates/scripts/prepare-metadata.py
@@ -44,11 +44,20 @@
 import jinja2
 import os
 import yaml
+import logging
 import netifaces
 import sys
 
 
+LOG = logging.getLogger(__name__)
+
+
 def main():
+    logging.basicConfig(
+        stream=sys.stdout,
+        format='%(asctime)s - %(levelname)s - %(message)s'
+    )
+    LOG.setLevel(logging.INFO)
 
     parser = argparse.ArgumentParser(
         description=('Render system files based on metadata')
@@ -65,14 +74,14 @@
     metadata = yaml.safe_load(render_template(args.metadata_file))
 
     if not metadata:
-        print("The metadata is empty")
+        LOG.info("The metadata is empty")
         return
     node_meta = get_node_metadata(metadata)
     if node_meta is not None:
-        print(f"Processing node_metadata: {node_meta}")
+        LOG.info(f"Processing node_metadata: {node_meta}")
         create_files(node_meta.get('write_files', []))
     else:
-        print("No matches to MACs for node_metadata found")
+        LOG.error("No matches to MACs for node_metadata found")
 
 def get_interface_mac(iface_name):
     mac = None
@@ -108,7 +117,7 @@
 
     :param file_path: str, path to the jinja2 template
     """
-    print("Reading template {0}".format(file_path))
+    LOG.info("Reading template {0}".format(file_path))
 
     path, filename = os.path.split(file_path)
     environment = jinja2.Environment(
@@ -122,5 +131,5 @@
     try:
         main()
     except Exception as e:
-        print(f"Failed to apply image layout: {e}")
+        LOG.exception(f"Failed to apply image layout: {e}")
         sys.exit(1)