diff --git a/src/core/logger.py b/src/core/logger.py index e2f9e3c2..ebf4e11b 100644 --- a/src/core/logger.py +++ b/src/core/logger.py @@ -11,8 +11,8 @@ def __init__(self, moduleName): self.environment = os.environ.get("ENVIRONMENT", "DEVELOPMENT") self.log = logging.getLogger(moduleName) - def info(self, msg): - self.log.info(msg) + def info(self, msg, *args, **kwargs): + self.log.info(msg, *args, **kwargs) def debug(self, msg): if self.environment == "DEVELOPMENT": @@ -24,5 +24,5 @@ def exception(self, msg): def prettyprint(self, msg): pp.pprint(msg) - def error(self, msg): - self.log.error(msg) + def error(self, msg, *args, **kwargs): + self.log.error(self, msg, *args, **kwargs) diff --git a/src/worker/audiovec/audio_worker.py b/src/worker/audiovec/audio_worker.py index 328e46ff..b415eaa4 100644 --- a/src/worker/audiovec/audio_worker.py +++ b/src/worker/audiovec/audio_worker.py @@ -30,6 +30,7 @@ def worker(ch, method, properties, body): file_content = json.loads(body) audio_path = AudioFactory.make_from_url(file_content['path']) try: + log.info("Processing File") media_type = MediaType.AUDIO audio_vec = audio_vec_embedding.run(audio_path) doc = { @@ -40,7 +41,7 @@ def worker(ch, method, properties, body): "date_added": datetime.utcnow(), } result = feluda.store.store(media_type, doc) - print(result) + log.info(result) report = make_report_indexed(file_content, "indexed") feluda.queue.message(feluda.config.queue.parameters.queues[1]['name'], report) ch.basic_ack(delivery_tag=method.delivery_tag) diff --git a/src/worker/audiovec/audio_worker_search.py b/src/worker/audiovec/audio_worker_search.py index f258de3b..3e345bd4 100644 --- a/src/worker/audiovec/audio_worker_search.py +++ b/src/worker/audiovec/audio_worker_search.py @@ -28,9 +28,10 @@ def worker(ch, method, properties, body): file_content = json.loads(body) audio_path = AudioFactory.make_from_url(file_content['path']) try: + log.info("Processsing File") audio_vec = audio_vec_embedding.run(audio_path) search_result = feluda.store.find("audio", audio_vec) - print(search_result) + log.info(search_result) report = make_report_indexed(file_content, "searched") feluda.queue.message(feluda.config.queue.parameters.queues[3]['name'], report) ch.basic_ack(delivery_tag=method.delivery_tag) diff --git a/src/worker/vidvec/video_worker.py b/src/worker/vidvec/video_worker.py index e9f02a67..63c2b921 100644 --- a/src/worker/vidvec/video_worker.py +++ b/src/worker/vidvec/video_worker.py @@ -49,12 +49,12 @@ def worker(ch, method, properties, body): file_content = json.loads(body) video_path = VideoFactory.make_from_url(file_content['path']) try: - print("Processing File:", video_path) + log.info("Processing file") video_vec = vid_vec_rep_resnet.run(video_path) doc = generate_document(video_path["path"], video_vec) media_type = MediaType.VIDEO result = feluda.store.store(media_type, doc) - print(result) + log.info(result) report = make_report_indexed(file_content, "indexed") feluda.queue.message(feluda.config.queue.parameters.queues[1]['name'], report) ch.basic_ack(delivery_tag=method.delivery_tag) diff --git a/src/worker/vidvec/video_worker_search.py b/src/worker/vidvec/video_worker_search.py index 099bb2fc..a57e73e0 100644 --- a/src/worker/vidvec/video_worker_search.py +++ b/src/worker/vidvec/video_worker_search.py @@ -28,11 +28,11 @@ def worker(ch, method, properties, body): file_content = json.loads(body) video_path = VideoFactory.make_from_url(file_content['path']) try: - print("Processing File:", video_path) + log.info("Processing File:") video_vec = vid_vec_rep_resnet.run(video_path) average_vector = next(video_vec) search_result = feluda.store.find("video", average_vector.get('vid_vec')) - print(search_result) + log.info(search_result) report = make_report_indexed(file_content, "searched") feluda.queue.message(feluda.config.queue.parameters.queues[3]['name'], report) ch.basic_ack(delivery_tag=method.delivery_tag)