JDBC PostgreSQL database appender. Requires https://github.com/clojure/java.jdbc, https://github.com/swaldman/c3p0.
JDBC PostgreSQL database appender. Requires https://github.com/clojure/java.jdbc, https://github.com/swaldman/c3p0.
(connect config)
(ensure-conn config)
(log-message config data)
(pgsql-appender db-config)
Returns a JDBC PostgreSQL appender. (pglog-appender {:server {:host "127.0.0.1" :port 5432}})
CREATE TABLE IF NOT EXISTS logs (
log_id bigserial primary key,
instant timestamp NOT NULL,
level varchar(20) NOT NULL,
namespace varchar(50) NOT NULL,
hostname varchar(30) NOT NULL,
content text NOT NULL,
error text NOT NULL
);
DROP TABLE IF EXISTS logs;
Using Migratus + Leiningen (in profiles.clj): :database-url "postgresql://<db_username>:<db_password>@<db_servername>:<db_port>/<db_schema>"
Using Boot + Ragtime (in build.boot): ragtime {:driver-class "org.postgresql.Driver" :database (str "jdbc:postgresql://<dbserver_name>:<db_port>/" "<db_schema>" "?user=<db_usernmae>" "&password=<db_password>")})
Returns a JDBC PostgreSQL appender. (pglog-appender {:server {:host "127.0.0.1" :port 5432}}) SQL ddl script for table creation and rollback ---------------------------------------------- ``` CREATE TABLE IF NOT EXISTS logs ( log_id bigserial primary key, instant timestamp NOT NULL, level varchar(20) NOT NULL, namespace varchar(50) NOT NULL, hostname varchar(30) NOT NULL, content text NOT NULL, error text NOT NULL ); DROP TABLE IF EXISTS logs; ``` To automate database migration ------------------------------ * Using Migratus + Leiningen (in profiles.clj): :database-url "postgresql://<db_username>:<db_password>@<db_servername>:<db_port>/<db_schema>" * Using Boot + Ragtime (in build.boot): ragtime {:driver-class "org.postgresql.Driver" :database (str "jdbc:postgresql://<dbserver_name>:<db_port>/" "<db_schema>" "?user=<db_usernmae>" "&password=<db_password>")})
(pool spec)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close