example_usage.py 678 B

123456789101112131415161718192021222324
  1. """Example using the current parser and CSV export service."""
  2. from pathlib import Path
  3. from mlog_tool.services import MLogService
  4. def main() -> None:
  5. service = MLogService()
  6. sample_log = Path(__file__).resolve().parents[2] / "mlog16.bin"
  7. output_dir = Path(__file__).resolve().parents[1] / "example_csv_output"
  8. parsed_log = service.parse(sample_log)
  9. print(f"Parsed: {parsed_log.source_path}")
  10. print(f"Data buses: {len(parsed_log.buses)}")
  11. print(f"Exporting CSV files to: {output_dir}")
  12. written_files = service.export_csv(parsed_log, output_dir)
  13. print(f"Exported {len(written_files)} CSV files")
  14. if __name__ == "__main__":
  15. main()