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
Datei anzeigen Open project: dotnet/ef6tools Class Usage Examples

Public Methods

Method 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.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

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

Private Methods

Method 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 method

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

DatabaseLogger() public method

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.
return System.Data.Entity.Infrastructure.DependencyResolution

Dispose() public method

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

Dispose() protected method

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. ///
return void

StartLogging() public method

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

StopLogging() public method

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