monkeysphere (0.12-1) UNRELEASED; urgency=low
- * Improved output handling.
+ * Improved output handling. New LOG_LEVEL variable.
* debian/control: switched Homepage: and Vcs-Git: to canonicalized
upstream hostnames.
- -- Jameson Graef Rollins <jrollins@phys.columbia.edu> Sun, 24 Aug 2008 23:49:23 -0700
+ -- Jameson Graef Rollins <jrollins@phys.columbia.edu> Mon, 01 Sep 2008 23:55:56 -0700
monkeysphere (0.11-1) experimental; urgency=low
# prefeced by "MONKEYSPHERE_" will take precedence over the values
# specified here.
+# Log level. Can be SILENT, ERROR, INFO, DEBUG, in increasing order
+# of verbosity.
+#LOG_LEVEL=INFO
+
# GPG keyserver to search for keys.
#KEYSERVER=subkeys.pgp.net
# prefeced by "MONKEYSPHERE_" will take precedence over the values
# specified here.
+# Log level. Can be SILENT, ERROR, INFO, DEBUG, in increasing order
+# of verbosity.
+#LOG_LEVEL=INFO
+
# GPG home directory. If not specified either here or in the
# MONKEYSPHERE_GNUPGHOME environment variable, then the value of the
# GNUPGHOME environment variable will be used. If GNUPGHOME is not
All environment variables defined in monkeysphere(1) can also be used
for the proxy command, with one note:
+.TP
+MONKEYSPHERE_LOG_LEVEL
+Set the log level. Can be SILENT, ERROR, INFO, DEBUG, in increasing
+order of verbosity.
+
.TP
MONKEYSPHERE_CHECK_KEYSERVER
Setting this variable (to `true' or `false') will override the policy
The following environment variables will override those specified in
the monkeysphere.conf configuration file (defaults in parentheses):
.TP
+MONKEYSPHERE_LOG_LEVEL
+Set the log level. Can be SILENT, ERROR, INFO, DEBUG, in increasing
+order of verbosity.
+.TP
MONKEYSPHERE_GNUPGHOME, GNUPGHOME
GnuPG home directory (~/.gnupg).
.TP
the monkeysphere-server.conf configuration file (defaults in
parentheses):
.TP
+MONKEYSPHERE_LOG_LEVEL
+Set the log level. Can be SILENT, ERROR, INFO, DEBUG, in increasing
+order of verbosity.
+.TP
MONKEYSPHERE_KEYSERVER
OpenPGP keyserver to use (subkeys.pgp.net).
.TP
exit ${2:-'255'}
}
-# write output to stderr
+# write output to stderr based on specified LOG_LEVEL the first
+# parameter is the priority of the output, and everything else is what
+# is echoed to stderr
log() {
+ local priority
local level
+ local output
- level="$1"
+ # translate lowers to uppers in global log level
+ LOG_LEVEL=$(echo "$LOG_LEVEL" | tr "[:lower:]" "[:upper:]")
+
+ # just go ahead and return if the log level is silent
+ if [ "$LOG_LEVEL" = 'SILENT' ] ; then
+ return
+ fi
+
+ # get priority from first parameter, translating all lower to
+ # uppers
+ priority=$(echo "$1" | tr "[:lower:]" "[:upper:]")
shift
- echo -n "ms: " >&2
- echo "$@" >&2
+ # scan over available levels
+ # list in decreasing verbosity (all caps)
+ for level in DEBUG INFO ERROR ; do
+ # output if the log level matches, set output to true
+ # this will output for all subsequenty loops as well.
+ if [ "$LOG_LEVEL" = "$level" ] ; then
+ output=true
+ fi
+ if [ "$priority" = "$level" -a "$output" = 'true' ] ; then
+ echo -n "ms: " >&2
+ echo "$@" >&2
+ fi
+ done
}
# cut out all comments(#) and blank lines from standard input
# set empty config variable with ones from the environment, or with
# defaults
-LOG_LEVEL=${MONKEYSPHERE_LOG_LEVEL:=${LOG_LEVEL:="info"}}
+LOG_LEVEL=${MONKEYSPHERE_LOG_LEVEL:=${LOG_LEVEL:="INFO"}}
KEYSERVER=${MONKEYSPHERE_KEYSERVER:=${KEYSERVER:="subkeys.pgp.net"}}
AUTHORIZED_USER_IDS=${MONKEYSPHERE_AUTHORIZED_USER_IDS:=${AUTHORIZED_USER_IDS:="%h/.config/monkeysphere/authorized_user_ids"}}
RAW_AUTHORIZED_KEYS=${MONKEYSPHERE_RAW_AUTHORIZED_KEYS:=${RAW_AUTHORIZED_KEYS:="%h/.ssh/authorized_keys"}}