diff --git a/mergin/client.py b/mergin/client.py index 6456c1b..a82ea99 100644 --- a/mergin/client.py +++ b/mergin/client.py @@ -19,7 +19,7 @@ from typing import List -from .common import ClientError, LoginError, WorkspaceRole, ProjectRole, LOG_FILE_SIZE_TO_SEND, MERGIN_DEFAULT_LOGS_URL +from .common import ClientError, LoginError, WorkspaceRole, ProjectRole, MAX_LOG_FILE_SIZE_TO_SEND, MERGIN_DEFAULT_LOGS_URL from .merginproject import MerginProject from .client_pull import ( download_file_finalize, @@ -1424,16 +1424,20 @@ def send_logs( platform.system(), self.url, self.username() ) + # We send more from the local logs + global_logs_file_size_to_send = MAX_LOG_FILE_SIZE_TO_SEND * 0.2 + local_logs_file_size_to_send = MAX_LOG_FILE_SIZE_TO_SEND * 0.8 + global_logs = b"" if global_log_file and os.path.exists(global_log_file): with open(global_log_file, "rb") as f: - if os.path.getsize(global_log_file) > LOG_FILE_SIZE_TO_SEND: - f.seek(-LOG_FILE_SIZE_TO_SEND, os.SEEK_END) + if os.path.getsize(global_log_file) > global_logs_file_size_to_send: + f.seek(-global_logs_file_size_to_send, os.SEEK_END) global_logs = f.read() + b"\n--------------------------------\n\n" with open(logfile, "rb") as f: - if os.path.getsize(logfile) > 512 * 1024: - f.seek(-512 * 1024, os.SEEK_END) + if os.path.getsize(logfile) > local_logs_file_size_to_send: + f.seek(-local_logs_file_size_to_send, os.SEEK_END) logs = f.read() payload = meta.encode() + global_logs + logs diff --git a/mergin/common.py b/mergin/common.py index 9e65a6c..a0b4760 100644 --- a/mergin/common.py +++ b/mergin/common.py @@ -7,7 +7,7 @@ UPLOAD_CHUNK_SIZE = 10 * 1024 * 1024 # size of the log file part to send (if file is larger only this size from end will be sent) -LOG_FILE_SIZE_TO_SEND = 100 * 1024 +MAX_LOG_FILE_SIZE_TO_SEND = 8 * 1024 * 1024 # default URL for submitting logs MERGIN_DEFAULT_LOGS_URL = "https://g4pfq226j0.execute-api.eu-west-1.amazonaws.com/mergin_client_log_submit"