s-fleck/lgrExtra

AppenderDbi with pool object

Opened this issue · 1 comments

AppenderDbi works great for shiny apps. The same is applicable for the connection pool produced by {pool}
However, pool object can't be used as a connection for the appender

con <- pool::dbPool(RPostgres::Postgres(), 
                    dbname = dbname,
                    host = host, 
                    port = port,
                    user = user, 
                    password = password)
lg <- get_logger("db_logger")
lg$
  set_propagate(FALSE)$
  add_appender(
    name = "db",
    lgrExtra::AppenderDbi$new(
      conn = con,
      table = "audit_log",
      buffer_size = 5L
    )
  )
  #Error in switch(cls, PostgreSQLConnection = LayoutPostgres$new(...), PqConnection = LayoutPostgres$new(...),  : 
  #EXPR must be a length 1 vector

It would be nice to have this functionality

thanks for your suggestion. it would be great to support pool objects. sadly i have less time right now to work on this package than i would want to have to so it might take a while till i get around to it :(