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.
30 lines
568 B
Bash
30 lines
568 B
Bash
#!/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"
|
|
}
|