CursorLens icon indicating copy to clipboard operation
CursorLens copied to clipboard

feat: unify fields as json to avoid parsing issues

Open mkczarkowski opened this issue 4 months ago • 0 comments

Improve Log Handling and Database Storage

This PR addresses the issue reported in #23 regarding empty log.body.messages on the logs page. The changes improve log handling, database storage, and overall code consistency.

Changes

  1. Optimized JSON handling:

    • Removed unnecessary JSON serialization
    • Leveraged PostgreSQL's native JSON support for more efficient data storage and retrieval
  2. Unified logging interface:

    • Standardized the way logs are handled throughout the application
    • Improved code consistency and readability
  3. Updated unit tests:

    • Revised LogDetails unit tests to ensure proper functionality with the new changes
  4. Database migration:

    • Prepared migration to change the 'headers' column type from text to json
    • This change will allow for more efficient and type-safe storage of header data

Benefits

  • Resolves the issue of improperly encoded log contents in the database
  • Improves data integrity and retrieval efficiency
  • Enhances code maintainability and readability
  • Strengthens the overall reliability of the logging system

Testing

The updated unit tests cover the new changes. Please run the test suite to ensure everything is working as expected.

Next Steps

After merging this PR, monitor the logs page to confirm that log.body.messages are now properly displayed and that there are no issues with log storage or retrieval.

Closes #23

mkczarkowski avatar Oct 12 '24 14:10 mkczarkowski