use app.logger.debug() instead of print()

This commit is contained in:
mst 2024-11-26 15:10:14 +03:00
parent cac5ba5661
commit 9c9970b930

View file

@ -271,7 +271,7 @@ def find_emoji_path(emoji_name):
else: else:
for address, dirs, files in os.walk(EMOJI_BASE_PATH): for address, dirs, files in os.walk(EMOJI_BASE_PATH):
print("\n[CatAsk/functions/find_emoji_path] Falling back to scanning directories\n") app.logger.debug("\n[CatAsk/functions/find_emoji_path] Falling back to scanning directories\n")
if f"{emoji_name}.png" in files: if f"{emoji_name}.png" in files:
rel_dir = os.path.relpath(address, EMOJI_BASE_PATH) rel_dir = os.path.relpath(address, EMOJI_BASE_PATH)
emoji_path = os.path.join("static/emojis", rel_dir, f"{emoji_name}.png") emoji_path = os.path.join("static/emojis", rel_dir, f"{emoji_name}.png")
@ -332,7 +332,7 @@ def listEmojiPacks():
# Check if a meta.json file exists in the directory # Check if a meta.json file exists in the directory
meta_json_path = const.emojiPath / f"{pack_dir}.json" meta_json_path = const.emojiPath / f"{pack_dir}.json"
if meta_json_path.exists(): if meta_json_path.exists():
print(f"[CatAsk/functions/listEmojiPacks] Using meta.json file ({meta_json_path})") app.logger.debug(f"[CatAsk/functions/listEmojiPacks] Using meta.json file ({meta_json_path})")
# Load data from the meta.json file # Load data from the meta.json file
pack_data = loadJSON(meta_json_path) pack_data = loadJSON(meta_json_path)
@ -345,7 +345,7 @@ def listEmojiPacks():
'emojis': pack_data.get('emojis', []) 'emojis': pack_data.get('emojis', [])
}) })
else: else:
print(f"[CatAsk/functions/listEmojiPacks] Falling back to directory scan ({pack_dir})") app.logger.debug(f"[CatAsk/functions/listEmojiPacks] Falling back to directory scan ({pack_dir})")
# If no meta.json is found, fall back to directory scan # If no meta.json is found, fall back to directory scan
preview_image = None preview_image = None
# Find the first image in the directory for preview # Find the first image in the directory for preview
@ -380,7 +380,7 @@ def processEmojis(meta_json_path):
'file_name': emoji['fileName'], 'file_name': emoji['fileName'],
} }
processed_emojis.append(emoji_info) processed_emojis.append(emoji_info)
print(f"[CatAsk/API/upload_emoji_pack] Processed emoji: {emoji_info['name']}\t(File: {emoji_info['file_name']})") app.logger.debug(f"[CatAsk/API/upload_emoji_pack] Processed emoji: {emoji_info['name']}\t(File: {emoji_info['file_name']})")
# Create the pack info structure # Create the pack info structure
pack_info = { pack_info = {