mirror of
https://gitea.tendokyu.moe/Hay1tsme/artemis.git
synced 2026-02-15 12:17:28 +08:00
logger: change from warn to warning
This commit is contained in:
@@ -57,7 +57,7 @@ class Mai2Base:
|
||||
events = self.data.static.get_enabled_events(self.version)
|
||||
events_lst = []
|
||||
if events is None or not events:
|
||||
self.logger.warn("No enabled events, did you run the reader?")
|
||||
self.logger.warning("No enabled events, did you run the reader?")
|
||||
return {"type": data["type"], "length": 0, "gameEventList": []}
|
||||
|
||||
for event in events:
|
||||
@@ -741,7 +741,7 @@ class Mai2Base:
|
||||
music_detail_list = []
|
||||
|
||||
if user_id <= 0:
|
||||
self.logger.warn("handle_get_user_music_api_request: Could not find userid in data, or userId is 0")
|
||||
self.logger.warning("handle_get_user_music_api_request: Could not find userid in data, or userId is 0")
|
||||
return {}
|
||||
|
||||
songs = self.data.score.get_best_scores(user_id, is_dx=False)
|
||||
@@ -794,46 +794,46 @@ class Mai2Base:
|
||||
upload_date = photo.get("uploadDate", "")
|
||||
|
||||
if order_id < 0 or user_id <= 0 or div_num < 0 or div_len <= 0 or not div_data or playlog_id < 0 or track_num <= 0 or not upload_date:
|
||||
self.logger.warn(f"Malformed photo upload request")
|
||||
self.logger.warning(f"Malformed photo upload request")
|
||||
return {'returnCode': 0, 'apiName': 'UploadUserPhotoApi'}
|
||||
|
||||
if order_id == 0 and div_num > 0:
|
||||
self.logger.warn(f"Failed to set orderId properly (still 0 after first chunk)")
|
||||
self.logger.warning(f"Failed to set orderId properly (still 0 after first chunk)")
|
||||
return {'returnCode': 0, 'apiName': 'UploadUserPhotoApi'}
|
||||
|
||||
if div_num == 0 and order_id > 0:
|
||||
self.logger.warn(f"First chuck re-send, Ignore")
|
||||
self.logger.warning(f"First chuck re-send, Ignore")
|
||||
return {'returnCode': 0, 'apiName': 'UploadUserPhotoApi'}
|
||||
|
||||
if div_num >= div_len:
|
||||
self.logger.warn(f"Sent extra chunks ({div_num} >= {div_len})")
|
||||
self.logger.warning(f"Sent extra chunks ({div_num} >= {div_len})")
|
||||
return {'returnCode': 0, 'apiName': 'UploadUserPhotoApi'}
|
||||
|
||||
if div_len >= 100:
|
||||
self.logger.warn(f"Photo too large ({div_len} * 10240 = {div_len * 10240} bytes)")
|
||||
self.logger.warning(f"Photo too large ({div_len} * 10240 = {div_len * 10240} bytes)")
|
||||
return {'returnCode': 0, 'apiName': 'UploadUserPhotoApi'}
|
||||
|
||||
ret_code = order_id + 1
|
||||
photo_chunk = b64decode(div_data)
|
||||
|
||||
if len(photo_chunk) > 10240 or (len(photo_chunk) < 10240 and div_num + 1 != div_len):
|
||||
self.logger.warn(f"Incorrect data size after decoding (Expected 10240, got {len(photo_chunk)})")
|
||||
self.logger.warning(f"Incorrect data size after decoding (Expected 10240, got {len(photo_chunk)})")
|
||||
return {'returnCode': 0, 'apiName': 'UploadUserPhotoApi'}
|
||||
|
||||
out_name = f"{self.game_config.uploads.photos_dir}/{user_id}_{playlog_id}_{track_num}"
|
||||
|
||||
if not path.exists(f"{out_name}.bin") and div_num != 0:
|
||||
self.logger.warn(f"Out of order photo upload (div_num {div_num})")
|
||||
self.logger.warning(f"Out of order photo upload (div_num {div_num})")
|
||||
return {'returnCode': 0, 'apiName': 'UploadUserPhotoApi'}
|
||||
|
||||
if path.exists(f"{out_name}.bin") and div_num == 0:
|
||||
self.logger.warn(f"Duplicate file upload")
|
||||
self.logger.warning(f"Duplicate file upload")
|
||||
return {'returnCode': 0, 'apiName': 'UploadUserPhotoApi'}
|
||||
|
||||
elif path.exists(f"{out_name}.bin"):
|
||||
fstats = stat(f"{out_name}.bin")
|
||||
if fstats.st_size != 10240 * div_num:
|
||||
self.logger.warn(f"Out of order photo upload (trying to upload div {div_num}, expected div {fstats.st_size / 10240} for file sized {fstats.st_size} bytes)")
|
||||
self.logger.warning(f"Out of order photo upload (trying to upload div {div_num}, expected div {fstats.st_size / 10240} for file sized {fstats.st_size} bytes)")
|
||||
return {'returnCode': 0, 'apiName': 'UploadUserPhotoApi'}
|
||||
|
||||
try:
|
||||
|
||||
@@ -552,7 +552,7 @@ class Mai2DX(Mai2Base):
|
||||
music_detail_list = []
|
||||
|
||||
if user_id <= 0:
|
||||
self.logger.warn("handle_get_user_music_api_request: Could not find userid in data, or userId is 0")
|
||||
self.logger.warning("handle_get_user_music_api_request: Could not find userid in data, or userId is 0")
|
||||
return {}
|
||||
|
||||
songs = self.data.score.get_best_scores(user_id)
|
||||
|
||||
@@ -85,7 +85,7 @@ class Mai2Reader(BaseReader):
|
||||
|
||||
def load_table_raw(self, dir: str, file: str, key: Optional[bytes]) -> Optional[List[Dict[str, str]]]:
|
||||
if not os.path.exists(f"{dir}/{file}"):
|
||||
self.logger.warn(f"file {file} does not exist in directory {dir}, skipping")
|
||||
self.logger.warning(f"file {file} does not exist in directory {dir}, skipping")
|
||||
return
|
||||
|
||||
self.logger.info(f"Load table {file} from {dir}")
|
||||
@@ -100,7 +100,7 @@ class Mai2Reader(BaseReader):
|
||||
f_data = f.read()[0x10:]
|
||||
|
||||
if f_data is None or not f_data:
|
||||
self.logger.warn(f"file {dir} could not be read, skipping")
|
||||
self.logger.warning(f"file {dir} could not be read, skipping")
|
||||
return
|
||||
|
||||
f_data_deflate = zlib.decompress(f_data, wbits = zlib.MAX_WBITS | 16)[0x12:] # lop off the junk at the beginning
|
||||
@@ -127,13 +127,13 @@ class Mai2Reader(BaseReader):
|
||||
try:
|
||||
struct_def.append(x[x.rindex(" ") + 2: -1])
|
||||
except ValueError:
|
||||
self.logger.warn(f"rindex failed on line {x}")
|
||||
self.logger.warning(f"rindex failed on line {x}")
|
||||
|
||||
if is_struct:
|
||||
self.logger.warn("Struct not formatted properly")
|
||||
self.logger.warning("Struct not formatted properly")
|
||||
|
||||
if not struct_def:
|
||||
self.logger.warn("Struct def not found")
|
||||
self.logger.warning("Struct def not found")
|
||||
|
||||
name = file[:file.index(".")]
|
||||
if "_" in name:
|
||||
@@ -148,7 +148,7 @@ class Mai2Reader(BaseReader):
|
||||
continue
|
||||
|
||||
if not line_match.group(1) == name.upper():
|
||||
self.logger.warn(f"Strange regex match for line {x} -> {line_match}")
|
||||
self.logger.warning(f"Strange regex match for line {x} -> {line_match}")
|
||||
continue
|
||||
|
||||
vals = line_match.group(2)
|
||||
|
||||
@@ -204,7 +204,7 @@ class Mai2ItemData(BaseData):
|
||||
|
||||
result = self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.warn(
|
||||
self.logger.warning(
|
||||
f"put_item: failed to insert item! user_id: {user_id}, item_kind: {item_kind}, item_id: {item_id}"
|
||||
)
|
||||
return None
|
||||
@@ -261,7 +261,7 @@ class Mai2ItemData(BaseData):
|
||||
|
||||
result = self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.warn(
|
||||
self.logger.warning(
|
||||
f"put_login_bonus: failed to insert item! user_id: {user_id}, bonus_id: {bonus_id}, point: {point}"
|
||||
)
|
||||
return None
|
||||
@@ -312,7 +312,7 @@ class Mai2ItemData(BaseData):
|
||||
|
||||
result = self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.warn(
|
||||
self.logger.warning(
|
||||
f"put_map: failed to insert item! user_id: {user_id}, map_id: {map_id}, distance: {distance}"
|
||||
)
|
||||
return None
|
||||
@@ -341,7 +341,7 @@ class Mai2ItemData(BaseData):
|
||||
conflict = sql.on_duplicate_key_update(**char_data)
|
||||
result = self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.warn(
|
||||
self.logger.warning(
|
||||
f"put_character_: failed to insert item! user_id: {user_id}"
|
||||
)
|
||||
return None
|
||||
@@ -371,7 +371,7 @@ class Mai2ItemData(BaseData):
|
||||
|
||||
result = self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.warn(
|
||||
self.logger.warning(
|
||||
f"put_character: failed to insert item! user_id: {user_id}, character_id: {character_id}, level: {level}"
|
||||
)
|
||||
return None
|
||||
@@ -414,7 +414,7 @@ class Mai2ItemData(BaseData):
|
||||
result = self.execute(conflict)
|
||||
|
||||
if result is None:
|
||||
self.logger.warn(
|
||||
self.logger.warning(
|
||||
f"put_friend_season_ranking: failed to insert",
|
||||
f"friend_season_ranking! aime_id: {aime_id}",
|
||||
)
|
||||
@@ -432,7 +432,7 @@ class Mai2ItemData(BaseData):
|
||||
|
||||
result = self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.warn(
|
||||
self.logger.warning(
|
||||
f"put_favorite: failed to insert item! user_id: {user_id}, kind: {kind}"
|
||||
)
|
||||
return None
|
||||
@@ -477,7 +477,7 @@ class Mai2ItemData(BaseData):
|
||||
|
||||
result = self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.warn(
|
||||
self.logger.warning(
|
||||
f"put_card: failed to insert card! user_id: {user_id}, kind: {card_kind}"
|
||||
)
|
||||
return None
|
||||
@@ -516,7 +516,7 @@ class Mai2ItemData(BaseData):
|
||||
|
||||
result = self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.warn(
|
||||
self.logger.warning(
|
||||
f"put_card: failed to insert charge! user_id: {user_id}, chargeId: {charge_id}"
|
||||
)
|
||||
return None
|
||||
@@ -541,7 +541,7 @@ class Mai2ItemData(BaseData):
|
||||
result = self.execute(conflict)
|
||||
|
||||
if result is None:
|
||||
self.logger.warn(
|
||||
self.logger.warning(
|
||||
f"put_user_print_detail: Failed to insert! aime_id: {aime_id}"
|
||||
)
|
||||
return None
|
||||
|
||||
@@ -488,7 +488,7 @@ class Mai2ProfileData(BaseData):
|
||||
|
||||
result = self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.warn(
|
||||
self.logger.warning(
|
||||
f"put_profile: Failed to create profile! user_id {user_id} is_dx {is_dx}"
|
||||
)
|
||||
return None
|
||||
@@ -525,7 +525,7 @@ class Mai2ProfileData(BaseData):
|
||||
|
||||
result = self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.warn(f"put_profile_ghost: failed to update! {user_id}")
|
||||
self.logger.warning(f"put_profile_ghost: failed to update! {user_id}")
|
||||
return None
|
||||
return result.lastrowid
|
||||
|
||||
@@ -552,7 +552,7 @@ class Mai2ProfileData(BaseData):
|
||||
|
||||
result = self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.warn(f"put_profile_extend: failed to update! {user_id}")
|
||||
self.logger.warning(f"put_profile_extend: failed to update! {user_id}")
|
||||
return None
|
||||
return result.lastrowid
|
||||
|
||||
@@ -582,7 +582,7 @@ class Mai2ProfileData(BaseData):
|
||||
|
||||
result = self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.warn(f"put_profile_option: failed to update! {user_id} is_dx {is_dx}")
|
||||
self.logger.warning(f"put_profile_option: failed to update! {user_id} is_dx {is_dx}")
|
||||
return None
|
||||
return result.lastrowid
|
||||
|
||||
@@ -616,7 +616,7 @@ class Mai2ProfileData(BaseData):
|
||||
|
||||
result = self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.warn(f"put_profile_rating: failed to update! {user_id}")
|
||||
self.logger.warning(f"put_profile_rating: failed to update! {user_id}")
|
||||
return None
|
||||
return result.lastrowid
|
||||
|
||||
@@ -643,7 +643,7 @@ class Mai2ProfileData(BaseData):
|
||||
|
||||
result = self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.warn(f"put_region: failed to update! {user_id}")
|
||||
self.logger.warning(f"put_region: failed to update! {user_id}")
|
||||
return None
|
||||
return result.lastrowid
|
||||
|
||||
@@ -668,7 +668,7 @@ class Mai2ProfileData(BaseData):
|
||||
|
||||
result = self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.warn(
|
||||
self.logger.warning(
|
||||
f"put_profile_activity: failed to update! user_id: {user_id}"
|
||||
)
|
||||
return None
|
||||
@@ -698,7 +698,7 @@ class Mai2ProfileData(BaseData):
|
||||
|
||||
result = self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.warn(
|
||||
self.logger.warning(
|
||||
f"put_web_option: failed to update! user_id: {user_id}"
|
||||
)
|
||||
return None
|
||||
@@ -720,7 +720,7 @@ class Mai2ProfileData(BaseData):
|
||||
|
||||
result = self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.warn(
|
||||
self.logger.warning(
|
||||
f"put_grade_status: failed to update! user_id: {user_id}"
|
||||
)
|
||||
return None
|
||||
@@ -742,7 +742,7 @@ class Mai2ProfileData(BaseData):
|
||||
|
||||
result = self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.warn(
|
||||
self.logger.warning(
|
||||
f"put_boss_list: failed to update! user_id: {user_id}"
|
||||
)
|
||||
return None
|
||||
@@ -763,7 +763,7 @@ class Mai2ProfileData(BaseData):
|
||||
|
||||
result = self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.warn(
|
||||
self.logger.warning(
|
||||
f"put_recent_rating: failed to update! user_id: {user_id}"
|
||||
)
|
||||
return None
|
||||
|
||||
@@ -161,7 +161,7 @@ class Mai2StaticData(BaseData):
|
||||
|
||||
result = self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.warn(f"Failed to insert song {song_id} chart {chart_id}")
|
||||
self.logger.warning(f"Failed to insert song {song_id} chart {chart_id}")
|
||||
return None
|
||||
return result.lastrowid
|
||||
|
||||
@@ -187,7 +187,7 @@ class Mai2StaticData(BaseData):
|
||||
|
||||
result = self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.warn(f"Failed to insert charge {ticket_id} type {ticket_type}")
|
||||
self.logger.warning(f"Failed to insert charge {ticket_id} type {ticket_type}")
|
||||
return None
|
||||
return result.lastrowid
|
||||
|
||||
@@ -237,7 +237,7 @@ class Mai2StaticData(BaseData):
|
||||
|
||||
result = self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.warn(f"Failed to insert card {card_id}")
|
||||
self.logger.warning(f"Failed to insert card {card_id}")
|
||||
return None
|
||||
return result.lastrowid
|
||||
|
||||
|
||||
Reference in New Issue
Block a user