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

Bug: Improve Debug Level Implementation for Clarity and Consistency #52

Open
berntpopp opened this issue Jul 19, 2024 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@berntpopp
Copy link
Member

Description

The current implementation of the debug level in filter_variants.sh is not clearly defined. There are inconsistencies in how and when messages are shown, particularly with ERROR messages not being logged to the console as expected. The debug levels need to be clearly defined to ensure that appropriate messages are displayed based on the selected level.

Steps to Reproduce

  1. Set the debug level to any available option (INFO, WARN, ERROR, DEBUG).
  2. Run the script with conditions that should trigger various log levels (e.g., errors, warnings, info messages).
  3. Observe that ERROR messages are not logged to the console.

Expected Behavior

  • INFO: Should display general informational messages about the script’s progress and key milestones.
  • WARN: Should display warnings about potential issues that do not stop the script from executing.
  • ERROR: Should display error messages that indicate problems, whether or not they halt the execution.
  • DEBUG: Should display detailed debugging information, including all INFO, WARN, and ERROR messages, as well as additional data useful for troubleshooting.

Actual Behavior

  • ERROR messages are not consistently logged to the console.
  • There is a lack of clarity on which messages are displayed for each debug level.

Proposed Changes

  • Clearly define the expected behavior for each debug level.
  • Ensure that all ERROR messages are logged to the console regardless of the debug level.
  • Implement a consistent logging mechanism that adheres to the defined behavior for each level.
  • Update the script to log messages appropriately based on the configured debug level.

Impact

Improving the debug level implementation will enhance the script’s usability and maintainability, making it easier to diagnose and resolve issues.

Additional Notes

  • Ensure backward compatibility with existing usage.
  • Update the documentation to reflect the new behavior and usage instructions for the debug levels.

Relevant Code Snippet

# Example of the current debug level implementation
log_message() {
    local message="$1"
    local level="$2"
    case $level in
        "INFO")
            [ "$DEBUG_LEVEL" == "INFO" ] && echo "[INFO] $message"
            ;;
        "WARN")
            [ "$DEBUG_LEVEL" == "INFO" ] || [ "$DEBUG_LEVEL" == "WARN" ] && echo "[WARN] $message"
            ;;
        "ERROR")
            [ "$DEBUG_LEVEL" == "INFO" ] || [ "$DEBUG_LEVEL" == "WARN" ] || [ "$DEBUG_LEVEL" == "ERROR" ] && echo "[ERROR] $message"
            ;;
        "DEBUG")
            [ "$DEBUG_LEVEL" == "DEBUG" ] && echo "[DEBUG] $message"
            ;;
    esac
}

# Example issue: ERROR messages are not shown when DEBUG_LEVEL is set to ERROR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant