Analyze MigMan log files and generate aggregated CSV, Markdown, HTML, and optional PDF reports.
Project description
nm-tool-forge
nm-tool-forge analyzes MigMan text log files with severity tokens such as INFO, ERROR, and WARNING and generates aggregated CSV, Markdown, HTML, and optional PDF reports.
The project uses a package-ready src layout. The legacy log_analysis.py file remains available as a thin compatibility entry point for older local setups.
Features
- Parse logical log entries from multi-line text logs
- Normalize recurring error patterns for better aggregation
- Generate aggregated CSV reports
- Generate Markdown summary reports
- Optionally convert reports to HTML and PDF
- Keep a backup copy of analyzed log files
- Run built-in self-tests from the CLI
Installation
Basic installation from a local checkout:
python -m pip install .
Installation with optional PDF support and developer tools:
python -m pip install .[pdf,dev]
Command-line usage
After installation, both entry points are available:
python -m loganalysis --help
loganalysis --help
nm-tool-forge --help
Typical analysis run:
nm-tool-forge --logs-dir logs --out-dir log_analyse_out
Analysis with HTML/PDF conversion:
nm-tool-forge --logs-dir logs --out-dir log_analyse_out --convert
Self-test mode:
python -m loganalysis --self-test
Legacy compatibility call:
python .\log_analysis.py --convert
Supported CLI options
--logs-dir--out-dir--backup-dir--top-examples--convert--self-test
Library usage
from pathlib import Path
from loganalysis import (
analyze_file,
convert_report_md_to_html_pdf,
iter_logical_entries,
normalize_message,
)
result = analyze_file(Path("logs/app.txt"))
print(result["norm_counts"])
print(normalize_message(
'Conversion: X =3100110. 138 The record was not found in table "Teile".'
))
for entry in iter_logical_entries(Path("logs/app.txt")):
print(entry)
convert_report_md_to_html_pdf(
Path("log_analyse_out/report.md"),
Path("log_analyse_out/report.html"),
Path("log_analyse_out/report.pdf"),
)
Project structure
.
├─ pyproject.toml
├─ src/loganalysis/
├─ tests/
├─ docs/
└─ log_analysis.py
Important modules:
analysis.py- file-level and overall aggregationparsing.py- logical entry detection and parsingnormalization.py- message normalizationreport_markdown.py- Markdown report model and renderingreport_html.py- HTML/CSS renderingreport_pdf.py- PDF engine selection and fallback handlingconverters.py- Markdown-to-HTML/PDF conversioncli.py- command-line entry point
HTML/PDF conversion
Report conversion is intentionally optional:
report.mdremains the primary human-readable outputreport.htmlis generated from the internal report modelreport.pdfis created when supported PDF tooling is available
PDF engine preference order:
weasyprintwkhtmltopdfpandoc+xelatexorpdflatex
If no supported PDF engine is available, the analysis still succeeds and generates Markdown and HTML output.
Windows-specific setup notes:
docs/install_gtk_weasyprint_windows.mddocs/install_xelatex_windows.md
Tests
pytest
Local build
python -m build
Expected artifacts:
dist/*.tar.gzdist/*.whl
Notes
The package name on PyPI/TestPyPI is nm-tool-forge, while the current Python import package remains loganalysis.
This keeps the first public release small and low-risk. A later follow-up release can still rename the import package if desired.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nm_tool_forge-0.1.0.tar.gz.
File metadata
- Download URL: nm_tool_forge-0.1.0.tar.gz
- Upload date:
- Size: 22.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e28f8a9ca42483fac59b6909ac0814a9fd8493e7985ecc9cfc8c44821c04e1f0
|
|
| MD5 |
972415ae83d37d60fef31f7f0c0247d6
|
|
| BLAKE2b-256 |
c44fa6fc0f63c6abe5c6d144e4b7b072b36723e0001745bbf252885fa0db4c65
|
File details
Details for the file nm_tool_forge-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nm_tool_forge-0.1.0-py3-none-any.whl
- Upload date:
- Size: 23.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fedc6314744f4f4ebc77e3a6ff5a47574cc6f81af4d76ea4f7b20d47c7a5cc7a
|
|
| MD5 |
3c0f634ee34a31ac5aa8b2af44f28b43
|
|
| BLAKE2b-256 |
9a3aca40814d3106b27eb7d5ba87eebd05a34af9539abdbe575536de52141e8b
|