Created
January 6, 2026 20:40
-
-
Save kristovatlas/88be132df8229f865f113e95d54d06cb to your computer and use it in GitHub Desktop.
Fix Railway breaking up logs across lines
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| def main(): | |
| if len(sys.argv) != 2: | |
| print("Usage: python fix_railway_logs.py <log_file>") | |
| sys.exit(1) | |
| filename = sys.argv[1] | |
| prefix_length = 38 | |
| content_parts = [] | |
| try: | |
| with open(filename, 'r') as f: | |
| lines = f.readlines() | |
| except FileNotFoundError: | |
| print(f"File not found: {filename}") | |
| sys.exit(1) | |
| for line in lines: | |
| if len(line) > prefix_length: | |
| content = line[prefix_length:].rstrip('\n') | |
| content_parts.append(content) | |
| else: | |
| print(f"Warning: Line too short to strip prefix: {line}") | |
| fixed_log = ''.join(content_parts) | |
| print(fixed_log) | |
| if __name__ == "__main__": | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment