Struct diesel_logger::LoggingConnection
[−]
[src]
pub struct LoggingConnection<C: Connection>(_);
Wraps a diesel Connection
to time and log each query using
the configured logger for the log
crate.
Currently, this produces a debug
log on every query,
an info
on queries that take longer than 1 second,
and a warn
ing on queries that take longer than 5 seconds.
These thresholds will be configurable in a future version.
Methods
impl<C: Connection> LoggingConnection<C>
[src]
Trait Implementations
impl<C: Connection> Deref for LoggingConnection<C>
[src]
type Target = C
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
Dereferences the value.
impl<C> SimpleConnection for LoggingConnection<C> where
C: Connection + Send + 'static,
[src]
C: Connection + Send + 'static,
fn batch_execute(&self, query: &str) -> QueryResult<()>
[src]
Execute multiple SQL statements within the same string. Read more
impl<C: Connection> Connection for LoggingConnection<C> where
C: Connection<TransactionManager = AnsiTransactionManager> + Send + 'static,
C::Backend: UsesAnsiSavepointSyntax,
<C::Backend as Backend>::QueryBuilder: Default,
[src]
C: Connection<TransactionManager = AnsiTransactionManager> + Send + 'static,
C::Backend: UsesAnsiSavepointSyntax,
<C::Backend as Backend>::QueryBuilder: Default,
type Backend = C::Backend
The backend this type connects to
type TransactionManager = C::TransactionManager
fn establish(database_url: &str) -> ConnectionResult<Self>
[src]
Establishes a new connection to the database Read more
fn execute(&self, query: &str) -> QueryResult<usize>
[src]
fn query_by_index<T, U>(&self, source: T) -> QueryResult<Vec<U>> where
T: AsQuery,
T::Query: QueryFragment<Self::Backend> + QueryId,
Self::Backend: HasSqlType<T::SqlType>,
U: Queryable<T::SqlType, Self::Backend>,
[src]
T: AsQuery,
T::Query: QueryFragment<Self::Backend> + QueryId,
Self::Backend: HasSqlType<T::SqlType>,
U: Queryable<T::SqlType, Self::Backend>,
fn query_by_name<T, U>(&self, source: &T) -> QueryResult<Vec<U>> where
T: QueryFragment<Self::Backend> + QueryId,
U: QueryableByName<Self::Backend>,
[src]
T: QueryFragment<Self::Backend> + QueryId,
U: QueryableByName<Self::Backend>,
fn execute_returning_count<T>(&self, source: &T) -> QueryResult<usize> where
T: QueryFragment<Self::Backend> + QueryId,
[src]
T: QueryFragment<Self::Backend> + QueryId,
fn transaction_manager(&self) -> &Self::TransactionManager
[src]
fn transaction<T, E, F>(&self, f: F) -> Result<T, E> where
E: From<Error>,
F: FnOnce() -> Result<T, E>,
[src]
E: From<Error>,
F: FnOnce() -> Result<T, E>,
Executes the given function inside of a database transaction Read more
fn begin_test_transaction(&self) -> Result<(), Error>
[src]
Creates a transaction that will never be committed. This is useful for tests. Panics if called while inside of a transaction. Read more
fn test_transaction<T, E, F>(&self, f: F) -> T where
E: Debug,
F: FnOnce() -> Result<T, E>,
[src]
E: Debug,
F: FnOnce() -> Result<T, E>,
Executes the given function inside a transaction, but does not commit it. Panics if the given function returns an error. Read more