Class FluentMigratorLogger
The base class for FluentMigrator-style ILogger implementations
Inheritance
Implements
Inherited Members
Namespace: FluentMigrator.Runner.Logging
Assembly: FluentMigrator.Runner.Core.dll
Syntax
public abstract class FluentMigratorLogger : ILogger
Constructors
FluentMigratorLogger(FluentMigratorLoggerOptions)
Initializes a new instance of the FluentMigratorLogger class.
Declaration
protected FluentMigratorLogger(FluentMigratorLoggerOptions options)
Parameters
Type | Name | Description |
---|---|---|
FluentMigratorLoggerOptions | options | The logger options |
Methods
BeginScope<TState>(TState)
Begins a logical operation scope.
Declaration
public IDisposable BeginScope<TState>(TState state)
Parameters
Type | Name | Description |
---|---|---|
TState | state | The identifier for the scope. |
Returns
Type | Description |
---|---|
IDisposable | An IDisposable that ends the logical operation scope on dispose. |
Type Parameters
Name | Description |
---|---|
TState | The type of the state to begin scope for. |
IsEnabled(LogLevel)
Checks if the given logLevel
is enabled.
Declaration
public bool IsEnabled(LogLevel logLevel)
Parameters
Type | Name | Description |
---|---|---|
LogLevel | logLevel | Level to be checked. |
Returns
Type | Description |
---|---|
bool |
|
Log<TState>(LogLevel, EventId, TState, Exception, Func<TState, Exception, string>)
Writes a log entry.
Declaration
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
Parameters
Type | Name | Description |
---|---|---|
LogLevel | logLevel | Entry will be written on this level. |
EventId | eventId | Id of the event. |
TState | state | The entry to be written. Can be also an object. |
Exception | exception | The exception related to this entry. |
Func<TState, Exception, string> | formatter | Function to create a string message of the |
Type Parameters
Name | Description |
---|---|
TState | The type of the object to be written. |
WriteElapsedTime(TimeSpan)
Writes the elapsed time
Declaration
protected abstract void WriteElapsedTime(TimeSpan timeSpan)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | timeSpan | The elapsed time |
WriteEmphasize(string)
Writes an emphasized text
Declaration
protected abstract void WriteEmphasize(string message)
Parameters
Type | Name | Description |
---|---|---|
string | message | The message to write |
WriteEmptySql()
Called when an attempt was made to write an empty SQL statement
Declaration
protected abstract void WriteEmptySql()
WriteError(Exception)
Writes an exception message
Declaration
protected abstract void WriteError(Exception exception)
Parameters
Type | Name | Description |
---|---|---|
Exception | exception | The exception containing the message |
WriteError(string)
Writes an error message
Declaration
protected abstract void WriteError(string message)
Parameters
Type | Name | Description |
---|---|---|
string | message | The error message |
WriteHeading(string)
Writes a heading
Declaration
protected abstract void WriteHeading(string message)
Parameters
Type | Name | Description |
---|---|---|
string | message | The heading message |
WriteSay(string)
Writes a message
Declaration
protected abstract void WriteSay(string message)
Parameters
Type | Name | Description |
---|---|---|
string | message | The message |
WriteSql(string)
Writes an SQL statement
Declaration
protected abstract void WriteSql(string sql)
Parameters
Type | Name | Description |
---|---|---|
string | sql | The SQL statement |