feat: modularize scripts and improve project architecture
All checks were successful
Auto Changelog & Release / release (push) Successful in 8s
All checks were successful
Auto Changelog & Release / release (push) Successful in 8s
- Added `lib/utils.sh` and `lib/logging.sh` for reusable utility and logging functions. - Updated `run.sh` and `scripts/generate-changelog.sh` to use the new utility and logging functions (`validate_arg`, `log_info`, `log_error`). - Add `config.env` for better clarity and updated all references in the project. - Enhanced documentation in `README.md` to reflect the new configuration file and usage instructions. - Improved error handling and logging consistency across scripts.
This commit is contained in:
29
lib/logging.sh
Normal file
29
lib/logging.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
# logging.sh - Logging functions for the project
|
||||
|
||||
# Log levels
|
||||
LOG_LEVEL_INFO="INFO"
|
||||
LOG_LEVEL_WARN="WARN"
|
||||
LOG_LEVEL_ERROR="ERROR"
|
||||
|
||||
# Function to log a message with a specific level
|
||||
log_message() {
|
||||
local level="$1"
|
||||
local message="$2"
|
||||
local timestamp
|
||||
timestamp=$(date +"%Y-%m-%d %H:%M:%S")
|
||||
echo "[$timestamp] [$level] $message"
|
||||
}
|
||||
|
||||
# Convenience functions for specific log levels
|
||||
log_info() {
|
||||
log_message "$LOG_LEVEL_INFO" "$1"
|
||||
}
|
||||
|
||||
log_warn() {
|
||||
log_message "$LOG_LEVEL_WARN" "$1"
|
||||
}
|
||||
|
||||
log_error() {
|
||||
log_message "$LOG_LEVEL_ERROR" "$1"
|
||||
}
|
Reference in New Issue
Block a user