fixed logging

This commit is contained in:
Emma Tebibyte 2023-04-03 13:32:49 -04:00
parent 281f52932e
commit a16a15e7a2
Signed by: emma
GPG Key ID: 6D661C738815E7DD
1 changed files with 3 additions and 3 deletions

View File

@ -11,7 +11,7 @@ set -e
# check if $LOG_DIR is set, if it isnt, provide a default
if test -z "$LOG_DIR"; then
LOG_DIR="$HOME/.var/log"
LOG_DIR="$HOME/.var/log/sway"
fi
# create log directory
@ -24,8 +24,8 @@ mv "$LOG_DIR/sway.log" "$LOG_DIR/sway.log.latest"
date '+%Y-%m-%dT%T %Z' >"$LOG_DIR/sway.log"
# count the number of previous log files
count=1
for file in "$LOG_DIR/sway.log.*"; do
count=0
for file in "$LOG_DIR"/sway.log.*; do
count="$(printf "%s+1\n" "$count" | bc)"
done