logging setup and user.clj

This commit is contained in:
Arne Brasseur 2022-12-04 10:39:46 +01:00
parent 39fe19f7a3
commit c0945cddb5
8 changed files with 79 additions and 5 deletions

View file

@ -21,6 +21,13 @@
;; Database
seancorfield/next.jdbc {:mvn/version "1.2.659"}
com.impossibl.pgjdbc-ng/pgjdbc-ng {:mvn/version "0.8.9"}
;; Logging
;; Webbing pulls in pedestal-log/glogi, but does not dictate the logging sink
org.slf4j/jul-to-slf4j {:mvn/version "2.0.3"}
org.slf4j/jcl-over-slf4j {:mvn/version "2.0.3"}
org.slf4j/log4j-over-slf4j {:exclusions [org.slf4j/slf4j-nop], :mvn/version "2.0.3"}
ch.qos.logback/logback-classic {:exclusions [org.slf4j/slf4j-api org.slf4j/slf4j-nop] :mvn/version "1.4.4"}
}
:aliases

View file

@ -1,3 +1,50 @@
(ns user)
(set! *print-namespace-maps* false)
(alter-var-root #'*print-namespace-maps* (constantly false))
(defmacro jit [sym]
`(requiring-resolve '~sym))
(def sys-id :lambdaisland/souk-dev)
(defn go []
((jit lambdaisland.webbing.dev/register!) sys-id 'lambdaisland.souk.setup/dev-setup)
((jit lambdaisland.webbing.dev/start!) {:sys-id sys-id}))
(defn stop! []
((jit lambdaisland.webbing.dev/stop!) {:sys-id sys-id}))
(defn restart []
((jit lambdaisland.webbing.dev/restart) sys-id))
(defn reset []
(stop!)
((jit clojure.tools.namespace.repl/set-refresh-dirs) "src" "test")
((jit clojure.tools.namespace.repl/refresh) :after `restart))
(defn reset-all []
(stop!)
((jit clojure.tools.namespace.repl/set-refresh-dirs) "src" "test")
((jit clojure.tools.namespace.repl/refresh-all) :after `restart))
(def portal-instance (atom nil))
(defn portal
"Open a Portal window and register a tap handler for it. The result can be
treated like an atom."
[]
(let [p ((jit portal.api/open) @portal-instance)]
(reset! portal-instance p)
(add-tap (jit portal.api/submit))
p))
(defn value [k]
(get ((jit k16.gx.beta.system/values) sys-id) k))
(defn browse []
((jit clojure.java.browse/browse-url) "http://localhost:9400/live"))
(comment
(value :http/server)
)

View file

@ -0,0 +1,4 @@
(ns repl-sessions.poke-classpath
(:require [lambdaisland.classpath :as licp]))
(licp/classpath-chain)

View file

@ -0,0 +1,4 @@
(ns repl-sessions.poke-logging
(:require [lambdaisland.glogc :as log]))
(log/warn :hello "world")

View file

@ -1,2 +1,2 @@
{:port 3444
{:port 3838
:dev/reload-routes? false}

12
resources/logback.xml Normal file
View file

@ -0,0 +1,12 @@
<configuration scan="true" scanPeriod="5 seconds">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>[%d{HH:mm:ss.SSS}] %highlight([%level]) [%logger] %msg%n</pattern>
<!-- <pattern>%d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n</pattern> -->
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
<logger name="lambdaisland.souk" level="TRACE" />
</configuration>

View file

@ -1,7 +1,7 @@
(ns lambdaisland.souk.components.router
"Reitit routes and router"
(:require
[lambdaisland.souk.dev-router :as dev-router]
[lambdaisland.souk.util.dev-router :as dev-router]
[muuntaja.core :as muuntaja]
[reitit.dev.pretty :as pretty]
[reitit.ring :as reitit-ring]

View file

@ -1,4 +1,4 @@
(ns lambdaisland.souk.dev-router
(ns lambdaisland.souk.util.dev-router
"Reitit router wrapper that auto-rebuilds, for REPL workflows."
(:require [reitit.core :as reitit]))