taoensso.timbre.appenders.3rd-party.postgresql
ensure-conn
(ensure-conn config)
log-message
(log-message config data)
pgsql-appender
(pgsql-appender db-config)
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>")})