Skip to main content

log.sh

#!/bin/bash

# ANSI color codes
COLOR_DEBUG="\033[0;32m" # Green
COLOR_INFO="\033[0;34m" # Blue
COLOR_ERROR="\033[0;31m" # Red
COLOR_RESET="\033[0m"

# Function to print debug messages with color
log_debug() {
local value=$*

printf "${COLOR_DEBUG}[DEBUG] ${COLOR_RESET}$value \n"
}

# Function to print info messages with color
log_info() {
local message=$*
printf "${COLOR_INFO}[INFO] ${COLOR_RESET}$message \n"
}

# Function to print error messages with color
log_error() {
local message=$*
printf "${COLOR_ERROR}[ERROR] ${COLOR_RESET}$message \n"
}

# Example usage
log_debug 1327104 1343586
log_error 1343488 1343586
log_info "Contribution Hash: "