feat(logging): first very simple logging implementation
Signed-off-by: Dominik Willner th33xitus@gmail.com
This commit is contained in:
@@ -48,9 +48,12 @@ function klipper_setup_dialog(){
|
||||
status_msg "Initializing Klipper installation ..."
|
||||
|
||||
### return early if klipper already exists
|
||||
if [ -n "$(klipper_exists)" ]; then
|
||||
local klipper_services
|
||||
klipper_services=$(klipper_exists)
|
||||
if [ -n "${klipper_services}" ]; then
|
||||
local error="At least one Klipper service is already installed:"
|
||||
for s in $(klipper_exists); do
|
||||
for s in ${klipper_services}; do
|
||||
log "Found Klipper service: ${s}"
|
||||
error="${error}\n ➔ ${s}"
|
||||
done
|
||||
print_error "${error}" && return
|
||||
|
||||
@@ -13,6 +13,7 @@ set -e
|
||||
|
||||
### base variables
|
||||
SYSTEMD="/etc/systemd/system"
|
||||
LOGFILE="/tmp/kiauh.log"
|
||||
|
||||
# setting up some frequently used functions
|
||||
check_euid(){
|
||||
@@ -27,6 +28,15 @@ check_euid(){
|
||||
fi
|
||||
}
|
||||
|
||||
function timestamp() {
|
||||
date +"[%F %T]"
|
||||
}
|
||||
|
||||
function log() {
|
||||
local message="${1}"
|
||||
echo -e "$(timestamp) ${message}" | tr -s " " >> "${LOGFILE}"
|
||||
}
|
||||
|
||||
check_klipper_cfg_path(){
|
||||
source_kiauh_ini
|
||||
if [ -z "${klipper_cfg_loc}" ]; then
|
||||
|
||||
Reference in New Issue
Block a user