Skip to content
Snippets Groups Projects
Commit b9c0e025 authored by Alexander van Amesfoort's avatar Alexander van Amesfoort
Browse files

Task #9127: ObservationStartListener: improve fmt of lofarlogger for shell scripts

parent f15c47d2
No related branches found
No related tags found
No related merge requests found
# lofarlogger.sh # lofarlogger.sh
# #
# Copyright (C) 2015 # Copyright (C) 2015-2016
# ASTRON (Netherlands Institute for Radio Astronomy) # ASTRON (Netherlands Institute for Radio Astronomy)
# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands # P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
# #
...@@ -22,12 +22,17 @@ ...@@ -22,12 +22,17 @@
# Usage: source lofarlogger.sh # Usage: source lofarlogger.sh
# then e.g.: log INFO "foo bar" # then e.g.: log INFO "foo bar"
# logs e.g.: 2015-10-16 16:00:46,186 INFO foo bar # logs e.g.: 2015-10-16 16:00:46,186 INFO - foo bar
log() { log() {
loglevel=$1 # one of: DEBUG INFO WARNING ERROR CRITICAL loglevel=$1 # one of: DEBUG INFO WARN ERROR FATAL
message=$2 message=$2
ts=`date --utc '+%F %T,%3N'` # e.g. 2015-10-16 16:00:46,186 ts=`date --utc '+%F %T,%3N'` # e.g. 2015-10-16 16:00:46,186
echo "$ts $loglevel $message" >&2 echo "$ts $loglevel - $message" >&2
}
fatal() {
log $1
exit 1
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment