{"id":22177626,"url":"https://github.com/ntidev/logbundle","last_synced_at":"2026-02-11T15:02:37.018Z","repository":{"id":57029127,"uuid":"63692419","full_name":"ntidev/LogBundle","owner":"ntidev","description":"Bundle used to log doctrine and exception events. Also has a service to use on demand.","archived":false,"fork":false,"pushed_at":"2024-10-07T20:20:35.000Z","size":75,"stargazers_count":0,"open_issues_count":2,"forks_count":1,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-08-02T21:52:29.744Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ntidev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2016-07-19T12:34:22.000Z","updated_at":"2024-08-19T14:55:27.000Z","dependencies_parsed_at":"2024-04-09T20:25:29.360Z","dependency_job_id":"35660fc1-e39c-46c4-a4ec-a7219eb2332d","html_url":"https://github.com/ntidev/LogBundle","commit_stats":{"total_commits":33,"total_committers":5,"mean_commits":6.6,"dds":0.4545454545454546,"last_synced_commit":"62396168ff5d30dd4dc880b4fdd4eeeeeb2e1010"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/ntidev/LogBundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntidev%2FLogBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntidev%2FLogBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntidev%2FLogBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntidev%2FLogBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ntidev","download_url":"https://codeload.github.com/ntidev/LogBundle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntidev%2FLogBundle/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270170404,"owners_count":24539357,"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-08-13T02:00:09.904Z","response_time":66,"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":[],"created_at":"2024-12-02T08:30:04.579Z","updated_at":"2026-02-11T15:02:36.969Z","avatar_url":"https://github.com/ntidev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NTILogBundle\n\n\n### Installation\n\n1. Install the bundle using composer:\n\n```\n$ composer require ntidev/log-bundle \"dev-master\"\n```\n\n\n2. Add the bundle configuration to the AppKernel\n\n\n```\npublic function registerBundles()\n{\n    $bundles = array(\n        ...\n        new NTI\\LogBundle\\NTILogBundle(),\n        ...\n    );\n}\n```\n\n3. Setup the configuration in the ``config.yml``\n\n```\n# NTI\nnti_log:\n    exclude: [ 'JMose\\CommandSchedulerBundle\\Entity\\ScheduledCommand' ]     # default: []\n```\n\nThe ``exclude`` allows you to exclude logging for specific entities that change at a rapid rate (for example the User entity usually registers changes when users log in)\n\n4. Update the database schema\n\n```\n$ php app/console doctrine:schema:update\n```\n\n\n### Usage\n\n1. Get the Logging service\n\n```\n$logger = $container-\u003eget('nti.logger');\n```\n\nThe following methods are available for logging:\n\n```\nlogNotice($message, $action = Log::ACTION_INFO, $entity = null)\nlogSuccess($message, $action = Log::ACTION_INFO, $entity = null)\nlogWarning($message, $action = Log::ACTION_INFO, $entity = null) \nlogDebug($message, $action = Log::ACTION_DEBUG, $entity = null)\nlogError($message, $action = Log::ACTION_INFO, $entity = null)    \nlogException(\\Exception $ex) \nlogSlack($message, $level = Log::LEVEL_NOTICE, $entity = null) \n```\n\nExample:\n\n```\n$service-\u003elogDebug(\"Hello World\")\n```\n\n\n### Event Listeners\n\nThe bundle comes with 2 event subscribers: ``DoctrineEventSubscriber`` and ``KernelExceptionListerner``.\n\nThe ``DoctrineEventSubscriber`` will listener for the following events:\n\n* PostPersist\n* PostUpdate\n* PostRemove\n\nAnd it will log the changes automatically into the database.\n\nThe ``KernelExceptionListener`` will capture all exceptions and log them into the database as well. However, if you capture an exception you must manually log it with the service, for example:\n\n```\ntry {\n    ...\n    $em-\u003eflush()\n} catch(\\Exception $ex) {\n    $this-\u003eget('nti.logger')-\u003elogException($ex);\n    ...\n}\n```\n\n### Slack Integration\n\nIf the [NexySlackBundle](https://github.com/nexylan/slack-bundle \"https://github.com/nexylan/slack-bundle\") is used, you can integrate this bundle to throw the information to a channel in Slack as well.\n\nThe configuration piece as shown above serves to configure how the NTILogBundle should post to Slack:\n\n```\n# NTI\nnti_log:\n    ...    \n    # In case NexySlackBundle is used\n    nexy_slack:\n        enabled:    # default: false\n        replicate_logs: true     # default: false\n        replicate_levels: [ERROR, DEBUG]   # default: [ERROR]\n        channel: \"#alertchannel\"  # default: empty, required\n        \n# NexySlackBundle\nnexy_slack:\n    # The Slack API Incoming WebHooks URL.\n    endpoint: \"[see https://api.slack.com/tokens to generate the webhook for this app]\"\n```\n\n## Todo\n\n* Make the entity configurable and also the property used to get the username","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fntidev%2Flogbundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fntidev%2Flogbundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fntidev%2Flogbundle/lists"}