{"id":23297283,"url":"https://github.com/Velyzo/InsightLog","last_synced_at":"2025-10-28T01:31:39.409Z","repository":{"id":265056014,"uuid":"894490954","full_name":"Velyzo/InsightLog","owner":"Velyzo","description":"Better logging utility.","archived":false,"fork":false,"pushed_at":"2025-08-18T20:18:37.000Z","size":841,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-04T10:57:47.930Z","etag":null,"topics":["better","log","logger","logging","python","simple","velis","wfxey"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Velyzo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"ko_fi":"wfxey"}},"created_at":"2024-11-26T12:56:56.000Z","updated_at":"2025-08-18T20:18:22.000Z","dependencies_parsed_at":"2025-09-04T10:39:59.814Z","dependency_job_id":"58ba24bd-67d7-4c2d-a7fc-7adabb3680c9","html_url":"https://github.com/Velyzo/InsightLog","commit_stats":null,"previous_names":["eldritchy/insightlog","veliscore/insightlog","velyzo/insightlog"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/Velyzo/InsightLog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Velyzo%2FInsightLog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Velyzo%2FInsightLog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Velyzo%2FInsightLog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Velyzo%2FInsightLog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Velyzo","download_url":"https://codeload.github.com/Velyzo/InsightLog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Velyzo%2FInsightLog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281361362,"owners_count":26487881,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-27T02:00:05.855Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["better","log","logger","logging","python","simple","velis","wfxey"],"created_at":"2024-12-20T07:16:46.741Z","updated_at":"2025-10-28T01:31:39.403Z","avatar_url":"https://github.com/Velyzo.png","language":"Python","funding_links":["https://ko-fi.com/wfxey"],"categories":[],"sub_categories":[],"readme":"# InsightLogger\n\n[![Python Version](https://img.shields.io/badge/python-3.9%2B-blue.svg)](https://python.org)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)\n[![PyPI](https://img.shields.io/pypi/v/insightlog.svg)](https://pypi.org/project/insightlog/)\n\nA comprehensive logging and monitoring library for Python applications with performance tracking, system monitoring, and analytics capabilities.\n\n## Installation\n\n```bash\npip install insightlog\n```\n\n## Quick Start\n\n```python\nfrom insightlog import InsightLogger\n\n# Basic setup\nlogger = InsightLogger(name=\"MyApp\")\n\n# Log messages\nlogger.log_types(\"INFO\", \"Application started\")\nlogger.log_types(\"ERROR\", \"Something went wrong\")\n\n# Track function performance\n@logger.log_function_time\ndef my_function():\n    # Your code here\n    pass\n\n# View insights\nlogger.view_insights()\n```\n\n## Features\n\n### Core Logging\n- Multiple log levels (INFO, DEBUG, ERROR, SUCCESS, WARNING, CRITICAL, etc.)\n- Colored console output\n- File logging with rotation\n- Contextual logging with metadata and tags\n\n### Performance Monitoring\n- Function execution time tracking\n- Memory usage monitoring\n- System resource monitoring (CPU, memory, network)\n- Custom metrics tracking\n\n### Analytics \u0026 Reporting\n- Performance profiling and bottleneck identification\n- Anomaly detection\n- Health scoring\n- HTML dashboard generation\n- Data export (JSON, CSV)\n\n### Advanced Features\n- Database logging (SQLite)\n- Email alerts for critical events\n- Security event logging\n- Plugin system for extensibility\n\n## Configuration\n\n### Basic Configuration\n\n```python\nlogger = InsightLogger(\n    name=\"MyApp\",\n    enable_monitoring=True,    # Enable system monitoring\n    enable_database=True,      # Enable database logging\n    enable_alerts=False        # Disable email alerts\n)\n```\n\n### Customizable Tracking Options\n\nYou can selectively enable/disable specific tracking features:\n\n```python\nlogger = InsightLogger(\n    name=\"MyApp\",\n    # Core settings\n    save_log=\"enabled\",           # File logging: \"enabled\" or \"disabled\"\n    log_level=logging.INFO,       # Log level\n    \n    # Monitoring options\n    enable_monitoring=True,       # System resource monitoring\n    enable_database=True,         # Database logging\n    enable_alerts=False,          # Email alerts\n    \n    # File settings\n    log_dir=\".insight\",          # Log directory\n    max_bytes=1000000,           # Max log file size\n    backup_count=3               # Number of backup files\n)\n```\n\n### Alert Configuration\n\n```python\n# Enable email alerts\nlogger = InsightLogger(\n    name=\"MyApp\",\n    enable_alerts=True,\n    alert_email=\"admin@company.com\",\n    smtp_server=\"smtp.gmail.com\",\n    smtp_port=587,\n    smtp_user=\"alerts@company.com\",\n    smtp_password=\"your_password\"\n)\n\n# Customize alert thresholds\nlogger.alert_thresholds = {\n    'cpu_usage': 80,        # CPU percentage\n    'memory_usage': 85,     # Memory percentage\n    'error_rate': 10,       # Error rate percentage\n    'response_time': 5000   # Response time in ms\n}\n```\n\n## Usage Examples\n\n### Performance Tracking\n\n```python\n# Method 1: Decorator\n@logger.log_function_time\ndef process_data():\n    # Your code here\n    pass\n\n# Method 2: Context manager\nwith logger.performance_profile(\"data_processing\"):\n    # Your code here\n    pass\n```\n\n### Custom Metrics\n\n```python\n# Track application-specific metrics\nlogger.add_custom_metric(\"active_users\", 150)\nlogger.add_custom_metric(\"cache_hit_rate\", 0.95)\n\n# Track API calls\nlogger.track_api_call(\"/api/users\", \"GET\", response_time=234, status_code=200)\n```\n\n### Security Logging\n\n```python\nlogger.log_security_event(\"LOGIN_ATTEMPT\", \"MEDIUM\", \"Failed login attempt\")\n```\n\n### Batch Logging\n\n```python\nlogs = [\n    {\"level\": \"INFO\", \"message\": \"Processing item 1\"},\n    {\"level\": \"INFO\", \"message\": \"Processing item 2\"},\n    (\"SUCCESS\", \"Batch completed\")\n]\nlogger.batch_log(logs)\n```\n\n### Contextual Logging\n\n```python\nlogger.log_with_context(\n    \"INFO\",\n    \"User action performed\",\n    context={\"user_id\": 12345, \"action\": \"file_upload\"},\n    tags=[\"user_activity\", \"audit\"]\n)\n```\n\n## Reports and Dashboards\n\n### Generate Reports\n\n```python\n# View insights in console\nlogger.view_insights(detailed=True)\n\n# Create HTML dashboard\nlogger.view_insights(create_dashboard=True)\n\n# Export data\nlogger.export_data(\"json\", include_raw_data=True)\nlogger.export_data(\"csv\")\n```\n\n### Output Files\n\nInsightLogger creates files in the `.insight` directory:\n\n```\n.insight/\n├── app.log                           # Log file\n├── insights_[session].db             # SQLite database\n├── dashboard_[session].html          # HTML dashboard\n├── log_frequency_[timestamp].png     # Charts\n├── system_metrics_[timestamp].png\n└── function_performance_[timestamp].png\n```\n\n## Framework Integration\n\n### Flask Example\n\n```python\nfrom flask import Flask\nfrom insightlog import InsightLogger\n\napp = Flask(__name__)\nlogger = InsightLogger(\"FlaskApp\", enable_monitoring=True)\n\n@app.route('/api/data')\n@logger.log_function_time\ndef get_data():\n    logger.track_api_call(\"/api/data\", \"GET\", response_time=150, status_code=200)\n    return {\"data\": \"example\"}\n```\n\n## Documentation\n\nFor detailed documentation, examples, and advanced usage, see the [docs](docs/) directory.\n\n## License\n\nMIT License. See [LICENSE](LICENSE) for details.\n\n## Contributing\n\nContributions are welcome! Please read our contributing guidelines and submit pull requests to our GitHub repository.\n\n## Support\n\n- GitHub Issues: [Report bugs](https://github.com/Velyzo/InsightLog/issues)\n- Documentation: [docs/](docs/)\n- PyPI: [https://pypi.org/project/insightlog/](https://pypi.org/project/insightlog/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FVelyzo%2FInsightLog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FVelyzo%2FInsightLog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FVelyzo%2FInsightLog/lists"}