Skip to content

Feature/implement tail with search and highlight #1

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

Open
wants to merge 30 commits into
base: main
Choose a base branch
from

Conversation

febinjoy
Copy link
Owner

@febinjoy febinjoy commented Nov 6, 2024

Implement tail with search and highlight

Issue Link

Implement base functionality of Search Tail

Problem Description

Monitoring and searching through large log files for specific keywords or patterns is a common task for developers and system administrators. Current tools lack efficient keyword highlighting and easy navigation through search results, making this process cumbersome and time-consuming. Additionally, constant monitoring of logs can be resource-intensive, adding to the inefficiency.

Solution

Develop a tool that offers the following features:

  • On-Demand Log Reloading: Reload log files by pressing r to save system resources compared to continuous monitoring.
  • Keyword Highlighting: Dynamically highlight specific keywords in the logs.
  • Customisable Highlighting: Allow users to specify keywords and customise their highlighting colours.
  • Tail Functionality: Provide an option -n to specify the number of lines to tail from the end of the file.
  • Search: Include options to search through the logs for specific phrases or keywords.
  • Navigation Through Results: Enable navigation through search results using n for the next occurrence and p for the previous occurrence of the keyword.

Environment Details

  • Operating System: Arch Linux
  • Python Version: 3.12.7
  • Other Details: No other libraries other than standard Python libraries.

How It Was Tested

Describe the testing process for this PR. Include details about the environment setup and the testing steps.

Test Cases

Keyword Highlighting

Test Case ID Description Expected Result Actual Result
TC01 Highlight the keyword "error" in the log file The keyword "error" is highlighted in the log file As expected
TC02 Highlight multiple occurrences of the keyword "warning" in the log file All occurrences of the keyword "warning" are highlighted As expected
TC03 Highlight case-insensitive keyword "INFO" in the log file The keyword "info" is highlighted regardless of case As expected

Customisable Highlighting

Test Case ID Description Expected Result Actual Result
TC04 Specify and highlight the keyword "debug" with blue color The keyword "debug" is highlighted in blue color As expected
TC05 Change the highlight color of the keyword "error" to red The keyword "error" is highlighted in red color As expected
TC06 Specify multiple keywords with different highlight colors Each keyword is highlighted in the specified color As expected

Tail Functionality

Test Case ID Description Expected Result Actual Result
TC07 Tail the last 10 lines of the log file using -n 10 The last 10 lines of the log file are displayed As expected
TC08 Tail the last 50 lines of the log file using -n 50 The last 50 lines of the log file are displayed As expected
TC09 Use -n option with a non-numeric value An error message is displayed indicating invalid input As expected

Search

Test Case ID Description Expected Result Actual Result
TC10 Search for the phrase "server error" in the log file All occurrences of "server error" are found and highlighted As expected
TC11 Search for the keyword "timeout" in the log file All occurrences of "timeout" are found and highlighted As expected
TC12 Search for a non-existent keyword "fatal" in the log file No occurrences are found. No lines/ search keywords highlighted. As expected

Navigation Through Results

Test Case ID Description Expected Result Actual Result
TC13 Navigate to the next occurrence of the keyword "error" using n The cursor moves to the next occurrence of "error" As expected
TC14 Navigate to the previous occurrence of the keyword "error" using p The cursor moves to the previous occurrence of "error" As expected
TC15 Use n when there are no more occurrences of the keyword Loops through the lines and go to the first instance at the start As expected
TC16 Use p when at the first occurrence of the keyword Loops through the lines and go to the last instance in the end As expected

Screenshots

Please refer to the updates in README.md

Documentation

Please refer to the updates in README.md

Checklist

  • I have linked the related issue.
  • I have followed the PR template.
  • I have provided comprehensive descriptions and context for the problem and solution.
  • I have documented the testing steps and included test cases with results.
  • I have included environment details.
  • I have added screenshots (if applicable).
  • I have updated the documentation (if applicable).
  • I have read and agreed to the project's contributing guidelines.

Additional Information

Add any other relevant information or comments here.


By submitting this PR, I acknowledge that my contribution is 100% my own and I agree to follow the project's Code of Conduct.

@febinjoy febinjoy marked this pull request as draft November 6, 2024 12:02
@febinjoy febinjoy self-assigned this Nov 7, 2024
@febinjoy febinjoy linked an issue Nov 7, 2024 that may be closed by this pull request
@febinjoy febinjoy marked this pull request as ready for review November 7, 2024 13:48
@febinjoy febinjoy requested a review from alokode November 7, 2024 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement base functionality of Search Tail
1 participant