Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/pretty format #103

Merged

Conversation

MEHRSHAD-MIRSHEKARY
Copy link
Collaborator

###JSON:

Key Features:

  • Command Overview: The command is designed to search for JSON files, handle multiple JSON objects within a single file, and output a prettified JSON format, enhancing readability and usability for developers and maintainers.
  • Directory Setup: Utilizes a helper function to establish the required directory structure, ensuring the presence of both the original and formatted directories.
  • File Processing: The command processes each .json file found in the specified directory, incrementally reading and reformatting the content to ensure that all JSON objects are valid and properly structured.
  • Error Handling: Implements error handling for file access issues and reports any incomplete JSON objects encountered during the processing, making it easier to troubleshoot formatting problems.
  • User Feedback: Provides console feedback during execution, informing users of the status of file processing and any issues that may arise.

This management command simplifies the task of formatting JSON logs, making them more accessible for analysis and further processing.

###XML:

Key Features:

  • Command Overview: The command searches for .xml files in the specified log directory and reformats them by encapsulating the existing content within a element, creating a valid XML structure.
  • Directory Setup: Utilizes helper functions to ensure that the required input and output directories are properly set up, enhancing usability and preventing file access errors.
  • File Processing: Iterates through each XML file, applies the reformatting logic, and saves the modified content to a new directory, helping maintain the original files unaltered.
  • Error Handling: Implements error handling to manage file access issues gracefully, providing feedback to users about any encountered problems.
  • User Feedback: Offers real-time console output during execution, notifying users of the processing status for each file and confirming successful reformatting.

This management command simplifies the task of restructuring XML logs, making them more organized and easier to work with for further analysis or integration.

Closes #94

…JSON from Log Directory

#### Key Features:
- **Command Overview**: The command is designed to search for JSON files, handle multiple JSON objects within a single file, and output a prettified JSON format, enhancing readability and usability for developers and maintainers.
- **Directory Setup**: Utilizes a helper function to establish the required directory structure, ensuring the presence of both the original and formatted directories.
- **File Processing**: The command processes each .json file found in the specified directory, incrementally reading and reformatting the content to ensure that all JSON objects are valid and properly structured.
- **Error Handling**: Implements error handling for file access issues and reports any incomplete JSON objects encountered during the processing, making it easier to troubleshoot formatting problems.
- **User Feedback**: Provides console feedback during execution, informing users of the status of file processing and any issues that may arise.

This management command simplifies the task of formatting JSON logs, making them more accessible for analysis and further processing.
…Files

#### Key Features:
- **Command Overview**: The command searches for .xml files in the specified log directory and reformats them by encapsulating the existing content within a <logs> element, creating a valid XML structure.
- **Directory Setup**: Utilizes helper functions to ensure that the required input and output directories are properly set up, enhancing usability and preventing file access errors.
- **File Processing**: Iterates through each XML file, applies the reformatting logic, and saves the modified content to a new directory, helping maintain the original files unaltered.
- **Error Handling**: Implements error handling to manage file access issues gracefully, providing feedback to users about any encountered problems.
- **User Feedback**: Offers real-time console output during execution, notifying users of the processing status for each file and confirming successful reformatting.

This management command simplifies the task of restructuring XML logs, making them more organized and easier to work with for further analysis or integration.

Closes Lazarus-org#94
Copy link
Collaborator

@ARYAN-NIKNEZHAD ARYAN-NIKNEZHAD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved 👌

@ARYAN-NIKNEZHAD ARYAN-NIKNEZHAD added the enhancement New feature or request label Oct 4, 2024
@ARYAN-NIKNEZHAD ARYAN-NIKNEZHAD merged commit a398786 into Lazarus-org:main Oct 4, 2024
5 checks passed
@MEHRSHAD-MIRSHEKARY MEHRSHAD-MIRSHEKARY deleted the feat/pretty-format branch October 11, 2024 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Django Commands to Reformat JSON and XML Log Files
2 participants