|
19 | 19 |
|
20 | 20 | from typing import List
|
21 | 21 |
|
22 |
| -from .common import ClientError, LoginError, WorkspaceRole, ProjectRole, LOG_FILE_SIZE_TO_SEND, MERGIN_DEFAULT_LOGS_URL |
| 22 | +from .common import ( |
| 23 | + ClientError, |
| 24 | + LoginError, |
| 25 | + WorkspaceRole, |
| 26 | + ProjectRole, |
| 27 | + MAX_LOG_FILE_SIZE_TO_SEND, |
| 28 | + MERGIN_DEFAULT_LOGS_URL, |
| 29 | +) |
23 | 30 | from .merginproject import MerginProject
|
24 | 31 | from .client_pull import (
|
25 | 32 | download_file_finalize,
|
@@ -1410,16 +1417,20 @@ def send_logs(
|
1410 | 1417 | platform.system(), self.url, self.username()
|
1411 | 1418 | )
|
1412 | 1419 |
|
| 1420 | + # We send more from the local logs |
| 1421 | + global_logs_file_size_to_send = MAX_LOG_FILE_SIZE_TO_SEND * 0.2 |
| 1422 | + local_logs_file_size_to_send = MAX_LOG_FILE_SIZE_TO_SEND * 0.8 |
| 1423 | + |
1413 | 1424 | global_logs = b""
|
1414 | 1425 | if global_log_file and os.path.exists(global_log_file):
|
1415 | 1426 | with open(global_log_file, "rb") as f:
|
1416 |
| - if os.path.getsize(global_log_file) > LOG_FILE_SIZE_TO_SEND: |
1417 |
| - f.seek(-LOG_FILE_SIZE_TO_SEND, os.SEEK_END) |
| 1427 | + if os.path.getsize(global_log_file) > global_logs_file_size_to_send: |
| 1428 | + f.seek(-global_logs_file_size_to_send, os.SEEK_END) |
1418 | 1429 | global_logs = f.read() + b"\n--------------------------------\n\n"
|
1419 | 1430 |
|
1420 | 1431 | with open(logfile, "rb") as f:
|
1421 |
| - if os.path.getsize(logfile) > 512 * 1024: |
1422 |
| - f.seek(-512 * 1024, os.SEEK_END) |
| 1432 | + if os.path.getsize(logfile) > local_logs_file_size_to_send: |
| 1433 | + f.seek(-local_logs_file_size_to_send, os.SEEK_END) |
1423 | 1434 | logs = f.read()
|
1424 | 1435 |
|
1425 | 1436 | payload = meta.encode() + global_logs + logs
|
|
0 commit comments