Giter Club home page Giter Club logo

lgrextra's People

Contributors

s-fleck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

lgrextra's Issues

Error in sprintf(message, ...) : too few arguments when try to log to database

I have tried to start logging to database:

lg <- get_logger("db_logger")
lg$
  set_propagate(FALSE)$
  add_appender(
    name = "db", 
    lgrExtra::AppenderDbi$new(
      conn = dbConnect(RPostgres::Postgres(),
                      dbname = "defaultdb",
                      host = "xxxxdb.ondigitalocean.com",
                      port = 25060L,
                      user = "doadmin",
                      password = "xxx"
      ),
      table = "log",
      buffer_size = 2L
    )
  )

but I get an error:

Error in sprintf(message, ...) : too few arguments

Appender for logDNA?

Hi,
I'm just parking this feature request here in case others might be interested as well. Our shop is moving from Postgres to using LogDNA.com (https://logdna.com/) for distributed application logging. There's an existing Python client for LogDNA (https://github.com/logdna/python), but nothing equivalent on CRAN yet.

Would seem a good fit for either lgr or @daroczig's logger?

AppenderDbi with pool object

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

Feature Request: AppenderAWSCloudWatchLog

A similar idea to #2, however using AWS CloudWatch logs. To achieve this I use paws to make the connection with AWS.

I have got an initial version of this on my folk: https://github.com/DyfanJones/lgrExtra/tree/aws_cloudwatch

remotes::install_github("dyfanjones/lgrExtra")
library(lgrExtra)

app <- AppenderAWSCloudWatchLog$new(log_group_name = "lgrExtra")
lg <- lgr::get_logger("lgrExtra")$add_appender(app)$set_propagate(FALSE)
lg$info("Foo")
lg$warn("Bar")
lg$error("cho")


> app$log_group_name
[1] "lgrExtra"
> app$log_stream_name
[1] "lgrExtra/2023-09-22/bm6qnrzt"
> app$data
[[1]]
[1] "INFO : Foo"

[[2]]
[1] "WARN : Bar"

[[3]]
[1] "ERROR: cho"

image

Let me know if your interested in adding this feature. I haven't added any unit tests as of yet, but happy to work on this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.