Giter Club home page Giter Club logo

diesel-logger's People

Contributors

blackdex avatar felinira avatar niklasha avatar pjenvey avatar shssoichiro avatar volker-weissmann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

diesel-logger's Issues

batch_execute queries not logged

Queries via SimpleConnection::batch_execute are currently not logged.

These can be useful to see in some cases, in particular batch_execute is used by diesel's Migrations. It's also used by the TransactionManager which would make the logging chattier if this were supported, particularly when there's lots of transactions in flight, e.g.:

[2020-09-15T20:13:03Z DEBUG diesel_logger] Query ran in 0.4 ms: RELEASE SAVEPOINT diesel_savepoint_1
[2020-09-15T20:13:03Z DEBUG diesel_logger] Query ran in 0.4 ms: SAVEPOINT diesel_savepoint_1

It could always be an option.

How do I view the debug logs?

Running something like this doesn't seem to work: RUST_LOG="debug" ./targets/debug/foo

I can't get it to log any queries (since none of them take more than 5 seconds yet)

Example with Diesel 2.x-rc.1?

Is there an example or any documentation on how to use this with Diesel 2.x rc1?

I'm using a connection pool right now -- something like this:

let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
let manager = ConnectionManager::<PgConnection>::new(database_url);

let connection_pool = Pool::builder()
    .max_size(15)
    .build(manager)
    .expect("Unable to build connection pool.");

pub fn connect(&self) -> Result<PooledConnection<ConnectionManager<PgConnection>>> {
    Ok(self.connection_pool.clone().get()?)
}

Using my connect function to get PooledConnection<ConnectionManager<PgConnection>> then using that with LoggingConnection produces a compile error.

// Produces an error
let conn  = LoggingConnection::new(conn);
error[E0407]: method `load` is not a member of trait `Connection`
   --> /Users/onx2/.cargo/git/checkouts/diesel-logger-4ba13af74e9b7c3c/915602c/src/lib.rs:98:5
    |
98  | /     fn load<'conn, 'query, T>(
99  | |         &'conn mut self,
100 | |         source: T,
101 | |     ) -> QueryResult<LoadRowIter<'conn, 'query, Self, Self::Backend>>
...   |
114 | |         res
115 | |     }
    | |_____^ not a member of trait `Connection`

error[E0599]: the method `load` exists for type parameter `C`, but its trait bounds were not satisfied
   --> /Users/onx2/.cargo/git/checkouts/diesel-logger-4ba13af74e9b7c3c/915602c/src/lib.rs:112:35
    |
112 |         let res = self.connection.load(query);
    |                                   ^^^^ method cannot be called on `C` due to unsatisfied trait bounds
    |
    = note: the following trait bounds were not satisfied:
            `C: Table`
            which is required by `C: diesel::RunQueryDsl<_>`
            `&C: Table`
            which is required by `&C: diesel::RunQueryDsl<_>`
            `&mut C: Table`
            which is required by `&mut C: diesel::RunQueryDsl<_>`

Some errors have detailed explanations: E0407, E0599.
For more information about an error, try `rustc --explain E0407`.
error: could not compile `diesel_logger` due to 2 previous errors
[Finished running. Exit status: 101]

I'm using the master branch right now because I don't think the most recent version on crates has the most recent code:

diesel = { git = "https://github.com/diesel-rs/diesel", branch = "2.0.x", features = ["chrono", "postgres", "r2d2", "uuid", "serde_json"] }
diesel_logger = { git = "https://github.com/shssoichiro/diesel-logger", branch = "master" }

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.