mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 14:12:41 +00:00
feat: Adds kanatactl to manage kanata installation, building, systemd service, etc.
This commit is contained in:
7
env/.local/scripts/hypr/logging
vendored
7
env/.local/scripts/hypr/logging
vendored
@@ -78,7 +78,7 @@ logging() {
|
||||
args=()
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
if [[ $1 == "-w" ]] || [[ $1 =~ ^--warn ]]; then
|
||||
if [[ $1 == "-w" ]] || [[ $1 == "--warn" ]] || [[ $1 == "--warning" ]]; then
|
||||
log_flag="1"
|
||||
warn_flag="1"
|
||||
elif [[ $1 == "-e" ]] || [[ $1 =~ ^--error ]]; then
|
||||
@@ -116,9 +116,10 @@ logging() {
|
||||
local time=$(date '+%D %H:%M:%S')
|
||||
|
||||
if [[ -z $file ]] || [[ -z $id ]] || [[ -z $label ]]; then
|
||||
echo "Loggging not properly setup."
|
||||
echo "Logging not properly setup."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local prefix="[id: $id][time: $time][source: \e[32m$source_file\e[0m][\e[34m$label\e[0m] :"
|
||||
local m="$prefix $msg"
|
||||
echo -e "$m" >>"$file"
|
||||
@@ -127,6 +128,8 @@ logging() {
|
||||
# Also log errors and warning messages to the console.
|
||||
if [[ $error_flag == "1" ]] || [[ $warn_flag == "1" ]]; then
|
||||
echo -e "[id: $id]$msg"
|
||||
elif [[ $warn_flag == "1" ]]; then
|
||||
echo -e "[id: $id]$msg"
|
||||
fi
|
||||
else
|
||||
# Dry run mode, so just log to the console
|
||||
|
||||
Reference in New Issue
Block a user