feat(logging): Implement database logging with app_log table

- Created migration to set up app_log table for storing application logs.
- Added AppLog entity and repository for ORM handling of logs.
- Developed DbLogger service to persist logs of level WARNING and above to the database while maintaining existing logging behavior.
- Implemented tests for admin log retrieval and DbLogger functionality to ensure proper logging behavior.
- Enhanced logging context sanitization for better error tracking.
This commit is contained in:
hamed
2026-06-29 20:01:03 +03:30
parent 830f7e8d0c
commit 803196108c
38 changed files with 3284 additions and 618 deletions
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
{"nodes": [{"id": "users_hamed_pj_my_pj_clinic_pro_clinicpro_src_shared_logging_applogrepository_php", "label": "AppLogRepository.php", "file_type": "code", "source_file": "src/Shared/Logging/AppLogRepository.php", "source_location": "L1"}, {"id": "logging_applogrepository_applogrepository", "label": "AppLogRepository", "file_type": "code", "source_file": "src/Shared/Logging/AppLogRepository.php", "source_location": "L8"}, {"id": "serviceentityrepository", "label": "ServiceEntityRepository", "file_type": "code", "source_file": "", "source_location": ""}, {"id": "logging_applogrepository_applogrepository_construct", "label": ".__construct()", "file_type": "code", "source_file": "src/Shared/Logging/AppLogRepository.php", "source_location": "L10"}, {"id": "managerregistry", "label": "ManagerRegistry", "file_type": "code", "source_file": "src/Shared/Logging/AppLogRepository.php", "source_location": "L10"}], "edges": [{"source": "users_hamed_pj_my_pj_clinic_pro_clinicpro_src_shared_logging_applogrepository_php", "target": "serviceentityrepository", "relation": "imports", "context": "import", "confidence": "EXTRACTED", "source_file": "src/Shared/Logging/AppLogRepository.php", "source_location": "L5", "weight": 1.0}, {"source": "users_hamed_pj_my_pj_clinic_pro_clinicpro_src_shared_logging_applogrepository_php", "target": "managerregistry", "relation": "imports", "context": "import", "confidence": "EXTRACTED", "source_file": "src/Shared/Logging/AppLogRepository.php", "source_location": "L6", "weight": 1.0}, {"source": "users_hamed_pj_my_pj_clinic_pro_clinicpro_src_shared_logging_applogrepository_php", "target": "logging_applogrepository_applogrepository", "relation": "contains", "confidence": "EXTRACTED", "source_file": "src/Shared/Logging/AppLogRepository.php", "source_location": "L8", "weight": 1.0}, {"source": "logging_applogrepository_applogrepository", "target": "serviceentityrepository", "relation": "inherits", "confidence": "EXTRACTED", "source_file": "src/Shared/Logging/AppLogRepository.php", "source_location": "L8", "weight": 1.0}, {"source": "logging_applogrepository_applogrepository", "target": "logging_applogrepository_applogrepository_construct", "relation": "method", "confidence": "EXTRACTED", "source_file": "src/Shared/Logging/AppLogRepository.php", "source_location": "L10", "weight": 1.0}, {"source": "logging_applogrepository_applogrepository_construct", "target": "managerregistry", "relation": "references", "confidence": "EXTRACTED", "source_file": "src/Shared/Logging/AppLogRepository.php", "source_location": "L10", "weight": 1.0, "context": "parameter_type"}], "raw_calls": [{"caller_nid": "logging_applogrepository_applogrepository_construct", "callee": "parent", "is_member_call": false, "source_file": "/Users/hamed/pj/my_pj/clinic_pro/clinicpro/src/Shared/Logging/AppLogRepository.php", "source_location": "L10", "receiver": null}]}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
{"nodes": [{"id": "users_hamed_pj_my_pj_clinic_pro_clinicpro_src_shared_logging_applog_php", "label": "AppLog.php", "file_type": "code", "source_file": "src/Shared/Logging/AppLog.php", "source_location": "L1"}, {"id": "logging_applog_applog", "label": "AppLog", "file_type": "code", "source_file": "src/Shared/Logging/AppLog.php", "source_location": "L8"}, {"id": "logging_applog_applog_construct", "label": ".__construct()", "file_type": "code", "source_file": "src/Shared/Logging/AppLog.php", "source_location": "L37"}, {"id": "logging_applog_applog_toarray", "label": ".toArray()", "file_type": "code", "source_file": "src/Shared/Logging/AppLog.php", "source_location": "L47"}], "edges": [{"source": "users_hamed_pj_my_pj_clinic_pro_clinicpro_src_shared_logging_applog_php", "target": "applogrepository", "relation": "imports", "context": "import", "confidence": "EXTRACTED", "source_file": "src/Shared/Logging/AppLog.php", "source_location": "L5", "weight": 1.0}, {"source": "users_hamed_pj_my_pj_clinic_pro_clinicpro_src_shared_logging_applog_php", "target": "mapping", "relation": "imports", "context": "import", "confidence": "EXTRACTED", "source_file": "src/Shared/Logging/AppLog.php", "source_location": "L6", "weight": 1.0}, {"source": "users_hamed_pj_my_pj_clinic_pro_clinicpro_src_shared_logging_applog_php", "target": "logging_applog_applog", "relation": "contains", "confidence": "EXTRACTED", "source_file": "src/Shared/Logging/AppLog.php", "source_location": "L8", "weight": 1.0}, {"source": "logging_applog_applog", "target": "logging_applog_applog_construct", "relation": "method", "confidence": "EXTRACTED", "source_file": "src/Shared/Logging/AppLog.php", "source_location": "L37", "weight": 1.0}, {"source": "logging_applog_applog", "target": "logging_applog_applog_toarray", "relation": "method", "confidence": "EXTRACTED", "source_file": "src/Shared/Logging/AppLog.php", "source_location": "L47", "weight": 1.0}], "raw_calls": [{"caller_nid": "logging_applog_applog_construct", "callee": "time", "is_member_call": false, "source_file": "/Users/hamed/pj/my_pj/clinic_pro/clinicpro/src/Shared/Logging/AppLog.php", "source_location": "L44", "receiver": null}]}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
{"nodes": [{"id": "users_hamed_pj_my_pj_clinic_pro_clinicpro_migrations_version20260629161536_php", "label": "Version20260629161536.php", "file_type": "code", "source_file": "migrations/Version20260629161536.php", "source_location": "L1"}, {"id": "migrations_version20260629161536_version20260629161536", "label": "Version20260629161536", "file_type": "code", "source_file": "migrations/Version20260629161536.php", "source_location": "L13"}, {"id": "abstractmigration", "label": "AbstractMigration", "file_type": "code", "source_file": "", "source_location": ""}, {"id": "migrations_version20260629161536_version20260629161536_getdescription", "label": ".getDescription()", "file_type": "code", "source_file": "migrations/Version20260629161536.php", "source_location": "L15"}, {"id": "migrations_version20260629161536_version20260629161536_up", "label": ".up()", "file_type": "code", "source_file": "migrations/Version20260629161536.php", "source_location": "L20"}, {"id": "schema", "label": "Schema", "file_type": "code", "source_file": "migrations/Version20260629161536.php", "source_location": "L20"}, {"id": "migrations_version20260629161536_version20260629161536_down", "label": ".down()", "file_type": "code", "source_file": "migrations/Version20260629161536.php", "source_location": "L26"}], "edges": [{"source": "users_hamed_pj_my_pj_clinic_pro_clinicpro_migrations_version20260629161536_php", "target": "schema", "relation": "imports", "context": "import", "confidence": "EXTRACTED", "source_file": "migrations/Version20260629161536.php", "source_location": "L7", "weight": 1.0}, {"source": "users_hamed_pj_my_pj_clinic_pro_clinicpro_migrations_version20260629161536_php", "target": "abstractmigration", "relation": "imports", "context": "import", "confidence": "EXTRACTED", "source_file": "migrations/Version20260629161536.php", "source_location": "L8", "weight": 1.0}, {"source": "users_hamed_pj_my_pj_clinic_pro_clinicpro_migrations_version20260629161536_php", "target": "migrations_version20260629161536_version20260629161536", "relation": "contains", "confidence": "EXTRACTED", "source_file": "migrations/Version20260629161536.php", "source_location": "L13", "weight": 1.0}, {"source": "migrations_version20260629161536_version20260629161536", "target": "abstractmigration", "relation": "inherits", "confidence": "EXTRACTED", "source_file": "migrations/Version20260629161536.php", "source_location": "L13", "weight": 1.0}, {"source": "migrations_version20260629161536_version20260629161536", "target": "migrations_version20260629161536_version20260629161536_getdescription", "relation": "method", "confidence": "EXTRACTED", "source_file": "migrations/Version20260629161536.php", "source_location": "L15", "weight": 1.0}, {"source": "migrations_version20260629161536_version20260629161536", "target": "migrations_version20260629161536_version20260629161536_up", "relation": "method", "confidence": "EXTRACTED", "source_file": "migrations/Version20260629161536.php", "source_location": "L20", "weight": 1.0}, {"source": "migrations_version20260629161536_version20260629161536_up", "target": "schema", "relation": "references", "confidence": "EXTRACTED", "source_file": "migrations/Version20260629161536.php", "source_location": "L20", "weight": 1.0, "context": "parameter_type"}, {"source": "migrations_version20260629161536_version20260629161536", "target": "migrations_version20260629161536_version20260629161536_down", "relation": "method", "confidence": "EXTRACTED", "source_file": "migrations/Version20260629161536.php", "source_location": "L26", "weight": 1.0}, {"source": "migrations_version20260629161536_version20260629161536_down", "target": "schema", "relation": "references", "confidence": "EXTRACTED", "source_file": "migrations/Version20260629161536.php", "source_location": "L26", "weight": 1.0, "context": "parameter_type"}], "raw_calls": [{"caller_nid": "migrations_version20260629161536_version20260629161536_up", "callee": "addSql", "is_member_call": true, "source_file": "/Users/hamed/pj/my_pj/clinic_pro/clinicpro/migrations/Version20260629161536.php", "source_location": "L23", "receiver": null}, {"caller_nid": "migrations_version20260629161536_version20260629161536_down", "callee": "addSql", "is_member_call": true, "source_file": "/Users/hamed/pj/my_pj/clinic_pro/clinicpro/migrations/Version20260629161536.php", "source_location": "L29", "receiver": null}]}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long