C# Class System.Data.Entity.Infrastructure.Interception.DatabaseLogger

A simple logger for logging SQL and other database operations to the console or a file. A logger can be registered in code or in the application's web.config /app.config file.
Inheritance: IDisposable, IDbConfigurationInterceptor
Afficher le fichier Open project: dotnet/ef6tools Class Usage Examples

Méthodes publiques

Méthode Description
DatabaseLogger ( ) : System.Data.Entity.Infrastructure.DependencyResolution

Creates a new logger that will send log output to the console.

DatabaseLogger ( string path ) : System.Data.Entity.Infrastructure.DependencyResolution

Creates a new logger that will send log output to a file. If the file already exists then it is overwritten.

Dispose ( ) : void

Stops logging and closes the underlying file if output is being written to a file.

StartLogging ( ) : void

Starts logging. This method is a no-op if logging is already started.

StopLogging ( ) : void

Stops logging. This method is a no-op if logging is not started.

Méthodes protégées

Méthode Description
Dispose ( bool disposing ) : void

Stops logging and closes the underlying file if output is being written to a file.

Private Methods

Méthode Description
DatabaseLogger ( string path, bool append ) : System.Data.Entity.Infrastructure.DependencyResolution
IDbConfigurationInterceptor ( DbConfigurationLoadedEventArgs loadedEventArgs, System.Data.Entity.Infrastructure.Interception.DbConfigurationInterceptionContext interceptionContext ) : void
StartLogging ( IDbDependencyResolver resolver ) : void
WriteThreadSafe ( string value ) : void

Method Details

DatabaseLogger() public méthode

Creates a new logger that will send log output to the console.
public DatabaseLogger ( ) : System.Data.Entity.Infrastructure.DependencyResolution
Résultat System.Data.Entity.Infrastructure.DependencyResolution

DatabaseLogger() public méthode

Creates a new logger that will send log output to a file. If the file already exists then it is overwritten.
public DatabaseLogger ( string path ) : System.Data.Entity.Infrastructure.DependencyResolution
path string A path to the file to which log output will be written.
Résultat System.Data.Entity.Infrastructure.DependencyResolution

Dispose() public méthode

Stops logging and closes the underlying file if output is being written to a file.
public Dispose ( ) : void
Résultat void

Dispose() protected méthode

Stops logging and closes the underlying file if output is being written to a file.
protected Dispose ( bool disposing ) : void
disposing bool /// True to release both managed and unmanaged resources; False to release only unmanaged resources. ///
Résultat void

StartLogging() public méthode

Starts logging. This method is a no-op if logging is already started.
public StartLogging ( ) : void
Résultat void

StopLogging() public méthode

Stops logging. This method is a no-op if logging is not started.
public StopLogging ( ) : void
Résultat void