def __init_logger(self, hw_variant_name, serial_number, campaign_report_path, session_id):
     # Initialize the logger
     log_file_name = '{0}_{1}{2}.log'.format(Util.get_timestamp(), hw_variant_name, str(serial_number))
     logfile = os.path.join(campaign_report_path, log_file_name)
     Files.acs_output_name = logfile[:-4]
     ACSLogging.set_session_id(session_id)
     ACSLogging.set_output_path(logfile)
    def create_report_folder(self):
        """
        Create report folder path from either a path specified by report_path
        or by creating one by computing timestamp, campaign and hw variant name.
        """
        if not self.__campaign_report_path:
            # Initialize the report path

            # Create the report folder for the current campaign
            if self._report_path is None:
                # No path specified (from ACS cmd line)
                # We are going to generate one report folder name
                # Adding timestamp
                campaign_folder_name = Util.get_timestamp()

                if self._hw_variant_name:
                    # Adding hw variant
                    campaign_folder_name += "_" + self._hw_variant_name

                if self._campaign_name:
                    # Adding current campaign name
                    campaign_name = os.path.splitext(
                        os.path.basename(self._campaign_name))[0]
                    campaign_folder_name += "_" + campaign_name

                campaign_report_path = os.path.join(os.getcwd(),
                                                    Folders.REPORTS,
                                                    campaign_folder_name)
            else:
                # Path specified (from ACS cmd line
                # Use it!
                campaign_report_path = self._report_path

            index = 1
            campaign_report_path_orig = campaign_report_path
            while os.path.exists(campaign_report_path):
                # Increment the folder name until it does not exists
                campaign_report_path = campaign_report_path_orig + "_" + str(
                    index)
                index += 1
            os.makedirs(campaign_report_path)
            self._logger.info("Campaign report path is %s" %
                              campaign_report_path)
            # Store the path of the folder
            self.__campaign_report_path = campaign_report_path