Handle localadmin and log-prefix.

This commit is contained in:
John Wiseman 2020-05-05 17:52:11 -07:00
parent b9c2e02ecb
commit 9ab7b0616f

View File

@ -176,7 +176,8 @@
(defn screenshot [icao lat lon now] (defn screenshot [icao lat lon now]
(p/let [image-path (str icao "-" (util/format-utc-ts now) ".png") (p/let [image-path (str (string/join "-" [@log-prefix icao (util/format-utc-ts now)])
".png")
_ (adsbx/screenshot-aircraft icao lat lon _ (adsbx/screenshot-aircraft icao lat lon
{:timeout 30000 {:timeout 30000
:output-path image-path :output-path image-path
@ -300,7 +301,7 @@
"?:[(callsign {callsign}) ]" "?:[(callsign {callsign}) ]"
;; Ideally neighbourhood as well as city or county, but ;; Ideally neighbourhood as well as city or county, but
;; maybe just city. ;; maybe just city.
"is circling over [{neighbourhood}, {locality}|{neighbourhood}, {county}|{locality}] " "is circling over [{neighbourhood}, {locality}|{neighbourhood}, {county}|{locality}|{localadmin}] "
;; Altitude. ;; Altitude.
"?:[at {alt} feet, ]" "?:[at {alt} feet, ]"
;; Speed; ;; Speed;
@ -515,7 +516,8 @@
lat lat
lon) lon)
(log-warn "Skipping tweeting")) (log-warn "Skipping tweeting"))
(let [path (str icao "-" (util/format-utc-ts now) ".geojson")] (let [path (str (string/join "-" [@log-prefix icao (util/format-utc-ts now)])
".geojson")]
(util/write-file (util/write-file
path path
(.stringify (.stringify
@ -617,9 +619,7 @@
(.option "--log-prefix <prefix>" "Log prefix to use") (.option "--log-prefix <prefix>" "Log prefix to use")
(.parse (.-argv js/process))) (.parse (.-argv js/process)))
(logging/set-log-prefix! (or (.-logPrefix commander) "")) (logging/set-log-prefix! (or (.-logPrefix commander) ""))
(reset! log-prefix (if (.-logPrefix commander) (reset! log-prefix (or (.-logPrefix commander) ""))
(str (.-logPrefix commander) "-")
""))
(let [start-time (current-time)] (let [start-time (current-time)]
;; If --config-path is specified, definitely try to read that ;; If --config-path is specified, definitely try to read that
;; file. Otherwise, only read config.yaml if it exists. ;; file. Otherwise, only read config.yaml if it exists.