Merge pull request 'Added better logging capabilities for debugging.' (#4) from issue1/bilderupload into master
Reviewed-on: swg/IMG-Helpr#4
This commit is contained in:
30
img-helpr.sh
30
img-helpr.sh
@@ -13,6 +13,25 @@
|
||||
## - November 2017, Version 1.01, Vorschaubild wird aus Exif geholt, wenn vorhanden
|
||||
## MODIFY AND SHARE AS YOU LIKE!
|
||||
|
||||
# Log levels for messages
|
||||
LLMUTE=0
|
||||
LLERROR=1
|
||||
LLWARNING=2
|
||||
LLINFO=3
|
||||
LLDEBUG=4
|
||||
# Actual log level of the logger used
|
||||
LOGLEVEL=$LLDEBUG
|
||||
|
||||
# Write log of the script
|
||||
function logger() {
|
||||
LOGGINGLEVEL=$1;
|
||||
LOGMESSAGE=$2;
|
||||
if [ $LOGLEVEL -ge $LOGGINGLEVEL ];
|
||||
then
|
||||
echo ${LOGMESSAGE};
|
||||
fi
|
||||
}
|
||||
|
||||
function CleanUp()
|
||||
{
|
||||
if [ -f "$local_blog_path/preview.jpg" ]; then
|
||||
@@ -34,11 +53,12 @@ if [ -x ${WITHFULLPATH} ];
|
||||
then
|
||||
echo ${WITHFULLPATH};
|
||||
else
|
||||
echo "${EXECUTABLE} not found! abort."
|
||||
$(logger $ERROR "${EXECUTABLE} not found! abort.");
|
||||
exit 1;
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Was wir am Anfang brauchen
|
||||
PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/global/bin:/global-common/scripts:/usr/sfw/bin:/opt/sfw/bin:/usr/ccs/bin:/usr/xpg4/bin:/opt/SUNWspro/bin:/usr/dt/bin:/usr/openwin/bin:/usr/ucb:/opt/bin
|
||||
|
||||
@@ -68,8 +88,8 @@ PRINTF=$(which_is "printf");
|
||||
SED=$(which_is "sed");
|
||||
|
||||
SCRIPTNAME=$(echo $0 | sed -e 's/.*\///g');
|
||||
VERSION="1.05";
|
||||
VERS=1.05;
|
||||
VERSION="1.06";
|
||||
VERS=1.06;
|
||||
ME=$(whoami);
|
||||
TMPPFAD=/tmp;
|
||||
MYHOME=$(echo ~);
|
||||
@@ -79,8 +99,8 @@ exec 3> >($MSGDIALOG --notification --listen);
|
||||
# The PID of zenity is needed to kill the process at the end of the script
|
||||
ZenityPID=$!;
|
||||
#((ZenityPID=ZenityPID+1)) # this is a workaround as I don't know how to get the PID of zenity (but get the one of exec)
|
||||
echo "tooltip:Scrip ${SCRIPTNAME}, Version ${VERSION}" >&3
|
||||
|
||||
echo "tooltip:Script ${SCRIPTNAME}, Version ${VERSION}" >&3
|
||||
#$(logger 3 "Script ${SCRIPTNAME}, Version ${VERSION}");
|
||||
if [ ! $# -gt 0 ]; then
|
||||
echo "img-helpr, Version: $VERSION, June 2021"
|
||||
echo "Syntax: img-helpr.sh IMG_FILE1 [IMG_FILE2 ...]";
|
||||
|
||||
Reference in New Issue
Block a user