- Issue created by @murz
- 🇦🇲Armenia murz Yerevan, Armenia
I extended the log displaying styles to allow display of AI Logging logs exactly like in the current module, here are the screenshots to compare:
AI Logging Logs page:
Extended Logger logs page:
This, for now, requires a patch from #3534928: [DB] Allow customizing the output of JSON fields on the logs page → but looks promising. So, we can just submit logs to the Drupal Logger, then clone and customize a Views page, provided by Extended Logger, to display the metadata as fields in nthe eeded format.
- 🇦🇲Armenia murz Yerevan, Armenia
The logs are rendered from the same source and the output is controlled by the Views field settings with no code changes, so here are two examples of how we can customize and beautify them:
- Just beautify the response object:
- Extract the response data into two separate fields (Response, Token usage):
- 🇦🇲Armenia murz Yerevan, Armenia
Decided to create a new module "ai_logger" that will log AI events to the standard PSR logger, and in another task, will introduce a separate module that will render the database-stored logs in the admin panel using Extended Logger and Views.
- Merge request !786Issue #3534876: Rework AI Logging to use the standard PSR Logger interface with passing metadata in context → (Open) created by murz
- 🇦🇲Armenia murz Yerevan, Armenia
Updated the implementation of the "AI Observability" module, which is now more or less ready for local testing and debugging, but the code and implementation are not clean enough for review.
Also, updated the issue description to match the current plan.
To simplify working with AI events, I also introduced a base class
AiProviderRequestBaseEvent
, which handles base event properties and getters-setters. - First commit to issue fork.
- 🇦🇲Armenia murz Yerevan, Armenia
Finally stabilized the feature! It should work well now, so please review it and make manual tests to ensure that everything works well.
Test steps:1. Using the default Drupal DBLog logger:
1.1. Make several different requests to AI providers.
1.2. See that the logs appeared on the "Recent log messages" page:
2. Using the Extended Logger:
2.1. Install the Extended Logger module version 1.3.0-beta2 →
2.2. Make several different requests to AI providers.
2.3. See that the logs appeared in a suitable way in both modules: Drupal DBLog logger and Extended Logger.
2.4. On the settings page/admin/config/ai/observability
- uncheck the checkbox "Fallback mode for the log message placeholders"
2.5. See that in the Drupal DBLog logger - placeholders appeared in the log message, but on the Extended Logger - placeholders were replaced with the values correctly.
2.6. Analyze the detailed data, stored in the log entry of the Extended Logger - it should store everything that we need.