コード例 #1
0
    def __init__(self):
        self.db = movie_service_resources.read_movie_service_database()
        self.movie_list = Movies(movies=[])
        for m in self.db:
            self.movie_list.movies.append(m)
        # print("movie list len:", str(len(self.movie_list.movies)))
        # print(str(self.movie_list.movies[24]))
        logger = logging.getLogger('SerializationTest')
        logger.setLevel(logging.DEBUG
                        )  # create file handler which logs even debug messages
        directory = "Logging"
        if not os.path.exists(directory):
            os.makedirs(directory)
        ts = time.time()
        st = datetime.datetime.fromtimestamp(ts).strftime('%Y_%m_%d_%H%M%S')
        filepath = directory + "//Serialization_" + st + ".log"

        fh = logging.FileHandler(filepath)
        fh.setLevel(logging.INFO)
        # create console handler with a higher log level
        ch = logging.StreamHandler()
        ch.setLevel(logging.INFO)  # handler = PingHandler()
        # create formatter and add it to the handlers
        formatter = logging.Formatter(
            '%(asctime)s - %(name)s - %(levelname)s - %(message)s')
        fh.setFormatter(formatter)
        ch.setFormatter(formatter)
        # add the handlers to the logger
        logger.addHandler(fh)
        logger.addHandler(ch)
        self.logger = logger
        self.logger.log(logging.INFO, "initializing completed...")
コード例 #2
0
    def __init__(self):
        self.db = movie_service_resources.read_movie_service_database()
        self.movie_list = Movies(movies=[])
        for m in self.db:
            self.movie_list.movies.append(m)
        # print("movie list len:", str(len(self.movie_list.movies)))
        # print(str(self.movie_list.movies[24]))
        logger = logging.getLogger('SerializationTest')
        logger.setLevel(logging.DEBUG)  # create file handler which logs even debug messages
        directory = "Logging"
        if not os.path.exists(directory):
            os.makedirs(directory)
        ts = time.time()
        st = datetime.datetime.fromtimestamp(ts).strftime('%Y_%m_%d_%H%M%S')
        filepath = directory + "//Serialization_" + st + ".log"

        fh = logging.FileHandler(filepath)
        fh.setLevel(logging.INFO)
        # create console handler with a higher log level
        ch = logging.StreamHandler()
        ch.setLevel(logging.INFO)  # handler = PingHandler()
        # create formatter and add it to the handlers
        formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
        fh.setFormatter(formatter)
        ch.setFormatter(formatter)
        # add the handlers to the logger
        logger.addHandler(fh)
        logger.addHandler(ch)
        self.logger = logger
        self.logger.log(logging.INFO, "initializing completed...")
コード例 #3
0
 def __init__(self):
     self.db = movie_service_resources.read_movie_service_database()
コード例 #4
0
 def __init__(self):
     self.db = movie_service_resources.read_movie_service_database()