dermatz / ddev-woodoo-buildtools-magento

ddev Addon to build Magento projects without headache
GNU General Public License v3.0
7 stars 2 forks source link

detailed logging #36

Open dermatz opened 1 month ago

dermatz commented 1 month ago

Add detailed logging options to better monitor the build process and diagnose errors more easily.

dermatz commented 1 month ago

apply new folder structure

image

Example Code

# Function to log error messages with timestamps
# Parameters:
#   $1: Error message
function logError() {
    local LOG_FILE=".ddev/commands/web/woodoo/logs/error.log"
    local TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S")
    echo "[${TIMESTAMP}] ERROR: $1" >> "${LOG_FILE}"
}

# Example usage of logError function
if [[ ! -d "${DDEV_COMPOSER_ROOT}/node_modules" ]]; then
    logError "node_modules folder not found at ${DDEV_COMPOSER_ROOT}/node_modules"
    echo -e "${txtred}${ICON_ERROR} node_modules folder not found. Please check the path: ${DDEV_COMPOSER_ROOT}/node_modules ${txtrst}"
fi