Files
loglens-cli/loglens/formatters/json_formatter.py
7000pctAUTO bc40082883
Some checks failed
CI / test (3.10) (push) Has been cancelled
CI / test (3.11) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
CI / test (3.9) (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / build (push) Has been cancelled
fix: add --version option to Click CLI group
- Added @click.version_option decorator to main() in commands.py
- Imported __version__ from loglens package
- Resolves CI build failure: 'loglens --version' command not found
2026-02-02 09:25:08 +00:00

15 lines
377 B
Python

import json
from typing import Any
from loglens.analyzers.analyzer import AnalysisResult
class JSONFormatter:
"""Format analysis results as JSON."""
def format(self, result: Any) -> str:
"""Format result as JSON."""
if hasattr(result, "to_dict"):
return json.dumps(result.to_dict(), indent=2)
return json.dumps(result, indent=2)