Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CLI flag to use longer (default) log format #3

Merged
merged 1 commit into from
Oct 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/updog/cli.clj
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@
[["-d" "--db APPSDB" "EDN apps database to use."
:default "appsdb.edn"
:validate [fs/exists? "Apps database file not found."]]
["-L" "--long-log" "Use longer log output format."]
["-v" "--verbose" "Enable verbose output (set log level to debug)."]
["-h" "--help" "Display help text and exit."]] )

@@ -256,6 +257,7 @@
{:output (usage cmd)}

:else
(run-command! {:db-file (:db options)
:log-level (if (:verbose options) :debug :info)}
(run-command! {:db-file (:db options)
:log-level (if (:verbose options) :debug :info)
:log-format (when (:long-log options) :long)}
cmd cmd-opts))))
8 changes: 5 additions & 3 deletions src/updog/system.clj
Original file line number Diff line number Diff line change
@@ -4,10 +4,12 @@

(defn init
"Initialize the application integrant system, using app `db-file`."
[{:keys [db-file log-level]}]
[{:keys [db-file log-level log-format]}]
(let [config (cond-> (-> (io/resource "system_config.edn") slurp ig/read-string)
db-file (assoc-in [:updog.apps-db.edn-db/apps-db :filename] db-file)
log-level (assoc-in [:updog.logging/timbre-logger :log-level] log-level))]
db-file (assoc-in [:updog.apps-db.edn-db/apps-db :filename] db-file)
log-level (assoc-in [:updog.logging/timbre-logger :log-level] log-level)
log-format (assoc-in [:updog.logging/timbre-logger :use-default-output-fn?]
(= log-format :long)))]
(ig/load-namespaces config)
(-> config
ig/prep