本文整理汇总了Python中src.common.logger.log函数的典型用法代码示例。如果您正苦于以下问题:Python log函数的具体用法?Python log怎么用?Python log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete_travel_request_documents
def delete_travel_request_documents(
self, object_ids=None, client_ids=None, line_ids=None, min_departure_datetime=None, max_departure_datetime=None
):
"""
Delete multiple travel_request_documents.
travel_request_document: {
'_id', 'client_id', 'line_id',
'starting_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
'ending_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
'departure_datetime', 'arrival_datetime',
'starting_timetable_entry_index', 'ending_timetable_entry_index'
}
:param object_ids: [ObjectId]
:param client_ids: [int]
:param line_ids: [int]
:param min_departure_datetime: datetime
:param max_departure_datetime
:return: None
"""
self.mongodb_database_connection.delete_travel_request_documents(
object_ids=object_ids,
client_ids=client_ids,
line_ids=line_ids,
min_departure_datetime=min_departure_datetime,
max_departure_datetime=max_departure_datetime,
)
log(
module_name="travel_requests_simulator", log_type="DEBUG", log_message="delete_travel_request_documents: ok"
)
示例2: test_delete_travel_request_documents
def test_delete_travel_request_documents(self, object_ids=None, client_ids=None, bus_line_ids=None,
min_departure_datetime=None, max_departure_datetime=None):
"""
Delete multiple travel_request_documents.
:param object_ids: [ObjectId]
:param client_ids: [int]
:param bus_line_ids: [int]
:param min_departure_datetime: datetime
:param max_departure_datetime
:return: None
"""
self.log_message = 'test_delete_travel_request_documents: starting'
log(module_name=self.module_name, log_type=self.log_type, log_message=self.log_message)
self.start_time = time.time()
self.travel_requests_simulator.delete_travel_request_documents(
object_ids=object_ids,
client_ids=client_ids,
bus_line_ids=bus_line_ids,
min_departure_datetime=min_departure_datetime,
max_departure_datetime=max_departure_datetime
)
self.elapsed_time = time.time() - self.start_time
self.log_message = 'test_delete_travel_request_documents: finished - elapsed_time = ' \
+ str(self.elapsed_time) + ' sec'
log(module_name=self.module_name, log_type=self.log_type, log_message=self.log_message)
示例3: __init__
def __init__(self):
self.mongodb_database_connection = MongodbDatabaseConnection(host=mongodb_host, port=mongodb_port)
log(
module_name="travel_requests_simulator",
log_type="DEBUG",
log_message="mongodb_database_connection: established",
)
示例4: test_insert_bus_vehicle_document
def test_insert_bus_vehicle_document(self, bus_vehicle_document=None, bus_vehicle_id=None,
maximum_capacity=None, routes=None):
"""
Insert a new bus_vehicle_document or update, if it already exists in the database.
:param bus_vehicle_document
:param bus_vehicle_id: int
:param maximum_capacity: int
:param routes: [{'starting_datetime', 'ending_datetime', 'timetable_id'}]
:return: new_object_id: ObjectId
"""
self.log_message = 'test_insert_bus_vehicle_document: starting'
log(module_name=self.module_name, log_type=self.log_type, log_message=self.log_message)
self.start_time = time.time()
new_object_id = self.bus_vehicle_handler.insert_bus_vehicle_document(
bus_vehicle_document=bus_vehicle_document,
bus_vehicle_id=bus_vehicle_id,
maximum_capacity=maximum_capacity,
routes=routes
)
self.elapsed_time = time.time() - self.start_time
self.log_message = 'test_insert_bus_vehicle_document: finished - elapsed_time = ' \
+ str(self.elapsed_time) + ' sec'
log(module_name=self.module_name, log_type=self.log_type, log_message=self.log_message)
return new_object_id
示例5: test_generate_traffic_data_between_two_bus_stops
def test_generate_traffic_data_between_two_bus_stops(self, starting_bus_stop=None, ending_bus_stop=None,
starting_bus_stop_name=None, ending_bus_stop_name=None):
"""
Generate random traffic density values for the edges which connect two bus_stops.
:param starting_bus_stop: bus_stop_document
:param ending_bus_stop: bus_stop_document
:param starting_bus_stop_name: string
:param ending_bus_stop_name: string
:return: None
"""
self.log_message = 'test_generate_traffic_data_between_two_bus_stops: starting'
log(module_name=self.module_name, log_type=self.log_type, log_message=self.log_message)
self.start_time = time.time()
self.traffic_data_simulator.generate_traffic_data_between_two_bus_stops(
starting_bus_stop=starting_bus_stop,
ending_bus_stop=ending_bus_stop,
starting_bus_stop_name=starting_bus_stop_name,
ending_bus_stop_name=ending_bus_stop_name
)
self.elapsed_time = time.time() - self.start_time
self.log_message = 'test_generate_traffic_data_between_two_bus_stops: finished - elapsed_time = ' \
+ str(self.elapsed_time) + ' sec'
log(module_name=self.module_name, log_type=self.log_type, log_message=self.log_message)
示例6: __init__
def __init__(self):
self.mongodb_database_connection = MongodbDatabaseConnection(host=mongodb_host, port=mongodb_port)
self.edge_documents = []
self.traffic_event_documents = []
self.minimum_longitude = float("inf")
self.maximum_longitude = float("-inf")
self.minimum_latitude = float("inf")
self.maximum_latitude = float("-inf")
log(module_name="traffic_data_parser", log_type="DEBUG", log_message="mongodb_database_connection: established")
示例7: clear_travel_requests_collection
def clear_travel_requests_collection(self):
"""
Clear all the documents of the TravelRequests collection.
:return: None
"""
self.mongodb_database_connection.clear_travel_request_documents_collection()
log(module_name='travel_requests_simulator', log_type='DEBUG',
log_message='clear_travel_request_documents_collection: ok')
示例8: terminate_traffic_data_generator_process
def terminate_traffic_data_generator_process(self):
if self.traffic_data_generator_process is not None:
self.traffic_data_generator_process.terminate()
self.traffic_data_generator_process.join()
self.traffic_data_generator_process = None
self.log_message = 'traffic_data_generator_process: terminated'
else:
'traffic_data_generator_process: None'
log(module_name=self.module_name, log_type=self.log_type, log_message=self.log_message)
示例9: test_update_traffic_data
def test_update_traffic_data(self):
self.log_message = 'update_traffic_data: starting'
log(module_name=self.module_name, log_type=self.log_type, log_message=self.log_message)
self.start_time = time.time()
self.traffic_data_parser.update_traffic_data()
self.elapsed_time = time.time() - self.start_time
self.log_message = 'update_traffic_data: finished - elapsed_time = ' \
+ str(self.elapsed_time) + ' sec'
log(module_name=self.module_name, log_type=self.log_type, log_message=self.log_message)
示例10: test_clear_traffic_density
def test_clear_traffic_density(self):
self.log_message = 'test_clear_traffic_density: starting'
log(module_name=self.module_name, log_type=self.log_type, log_message=self.log_message)
self.start_time = time.time()
self.traffic_data_simulator.clear_traffic_density()
self.elapsed_time = time.time() - self.start_time
self.log_message = 'test_clear_traffic_density: finished - elapsed_time = ' \
+ str(self.elapsed_time) + ' sec'
log(module_name=self.module_name, log_type=self.log_type, log_message=self.log_message)
示例11: clear_bus_vehicle_documents_collection
def clear_bus_vehicle_documents_collection(self):
"""
Delete all the documents of the BusVehicleDocuments collection.
:return: number_of_deleted_documents: int
"""
number_of_deleted_documents = self.mongodb_database_connection.clear_bus_vehicle_documents_collection()
self.log_message = 'clear_bus_vehicle_documents_collection: number_of_deleted_documents: ' + \
str(number_of_deleted_documents)
log(module_name=self.module_name, log_type=self.log_type, log_message=self.log_message)
return number_of_deleted_documents
示例12: start_traffic_data_parser_process
def start_traffic_data_parser_process(self):
if self.traffic_data_parser_process is None:
self.traffic_data_parser_process = Process(
target=self.handle_traffic_data_updater_process,
args=()
)
self.traffic_data_parser_process.start()
self.log_message = 'traffic_data_parser_process: starting'
else:
self.log_message = 'traffic_data_parser_process: already started'
log(module_name=self.module_name, log_type=self.log_type, log_message=self.log_message)
示例13: start_traffic_data_generator_process
def start_traffic_data_generator_process(self):
if self.traffic_data_generator_process is None:
self.traffic_data_generator_process = Process(
target=self.test_generate_traffic_data_for_bus_lines,
args=()
)
self.traffic_data_generator_process.start()
self.log_message = 'traffic_data_generator_process: starting'
else:
self.log_message = 'traffic_data_generator_process: already started'
log(module_name=self.module_name, log_type=self.log_type, log_message=self.log_message)
示例14: __init__
def __init__(self):
self.module_name = 'bus_vehicle_handler_tester'
self.log_type = 'INFO'
self.log_message = 'initialize_bus_vehicle_handler: starting'
log(module_name=self.module_name, log_type=self.log_type, log_message=self.log_message)
self.start_time = time.time()
self.bus_vehicle_handler = BusVehicleHandler()
self.elapsed_time = time.time() - self.start_time
self.log_message = 'initialize_bus_vehicle_handler: finished - elapsed_time = ' \
+ str(self.elapsed_time) + ' sec'
log(module_name=self.module_name, log_type=self.log_type, log_message=self.log_message)