Liking cljdoc? Tell your friends :D

taoensso.timbre.appenders.community.postgresql

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.
raw docstring

connclj

source

connectclj

(connect config)
source

default-pool-specclj

source

ensure-connclj

(ensure-conn config)
source

log-messageclj

(log-message config data)
source

pgsql-appenderclj

(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>")})

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>")})
sourceraw docstring

poolclj

(pool spec)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close