Skip to content

Instantly share code, notes, and snippets.

@kristovatlas
Created January 6, 2026 20:40
Show Gist options
  • Select an option

  • Save kristovatlas/88be132df8229f865f113e95d54d06cb to your computer and use it in GitHub Desktop.

Select an option

Save kristovatlas/88be132df8229f865f113e95d54d06cb to your computer and use it in GitHub Desktop.
Fix Railway breaking up logs across lines
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