Skip to content

Commit d967da8

Browse files
authored
log on migration and allow setting log level on aws (#412)
1 parent 2affd32 commit d967da8

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

dev-resources/template/2_lrs.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,18 @@ Parameters:
137137
Description: A comma-separated list of origins to allow. If not provided ALBHostName will be used if present, otherwise no origins will be allowed.
138138

139139
# Logging Settings
140+
LogLevel:
141+
Description: Detail of SQL LRS Logging level.
142+
Type: String
143+
AllowedValues:
144+
- ALL
145+
- TRACE
146+
- DEBUG
147+
- INFO
148+
- WARN
149+
- ERROR
150+
- OFF
151+
Default: INFO
140152
LogRetentionInDays:
141153
Description: How long to retain CloudWatch Logs from the LRSQL Instance
142154
Type: Number
@@ -304,7 +316,7 @@ Resources:
304316
Runtime: 'python3.8'
305317
Timeout: 10
306318

307-
# Run the lambda init fn as a custom resource
319+
# Run the lambda init fn as a custom resource
308320
GenerateJWTSecretResource:
309321
Type: Custom::generateJWTSecretCustomResource
310322
DependsOn: GenerateJWTSecretFunction
@@ -574,6 +586,9 @@ Resources:
574586
"httpPort": ${InstanceHttpPort},
575587
"allowedOrigins": ${AllowedOrigins},
576588
"jwtCommonSecret": "${GenerateJWTSecretResource.random_string}"
589+
},
590+
"logger": {
591+
"logLevel":"${LogLevel}"
577592
}
578593
}
579594
- DBName:

src/main/lrsql/init.clj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
(ns lrsql.init
22
"Initialize HugSql functions and state."
3-
(:require [hugsql.core :as hugsql]
3+
(:require [clojure.tools.logging :as log]
4+
[hugsql.core :as hugsql]
45
[hugsql.adapter.next-jdbc :as next-adapter]
56
[lrsql.backend.protocol :as bp]
67
[lrsql.input.admin :as admin-input]
@@ -23,8 +24,11 @@
2324
(bp/-set-read! backend)
2425
(bp/-set-write! backend)
2526
;; Init DDL
27+
(log/debug "Ensuring Tables...")
2628
(bp/-create-all! backend tx)
27-
(bp/-update-all! backend tx))
29+
(log/debug "Running Migrations...")
30+
(bp/-update-all! backend tx)
31+
(log/debug "SQL backend initialization complete!"))
2832

2933
(defn insert-default-creds!
3034
"Seed the credential table with the default API key and secret, as well as

0 commit comments

Comments
 (0)