feat: add log date

This commit is contained in:
2023-12-11 16:22:31 +02:00
parent 67fac35250
commit 249439cf9a

9
search
View File

@@ -11,7 +11,8 @@ SUFFIX="$2"
URL_DESC="${3:-Project}"
log() {
echo "$@" >> log.txt
fdate=$(date "+%Y-%m-%d %H:%M:%S")
echo "[$fdate] $*" >> log.txt
}
if [[ -z "$GROUP" ]]; then
@@ -33,16 +34,14 @@ else
mkdir .cache
fi
# remove files older than 1 week
find .cache -type f -mtime +7 -name '*.json' -exec rm {} \;
# remove files older than 30 days
find .cache -type f -mtime +30 -name '*.json' -exec rm {} \;
query=$1
hash=$(echo "$query" | md5 -q)
log "Query: $query, Hash: $hash"
log "Query: $query, Hash: $hash"
# cache file location
fl=".cache/projects-$hash.json"