33 lines
1.0 KiB
C#
33 lines
1.0 KiB
C#
using LCU.API.Internal.DocumentLib.Containers;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace OwnerNumberMigration.Logging;
|
|
|
|
public delegate IObserver<DocumentInformation> AttributeMigrationLoggingObserverFactory(string attributeName);
|
|
|
|
public class AttributeMigrationLoggingObserver : IObserver<DocumentInformation>
|
|
{
|
|
private readonly ILogger _logger;
|
|
private readonly string _attributeName;
|
|
|
|
public AttributeMigrationLoggingObserver(ILogger logger, string attributeName)
|
|
{
|
|
_logger = logger;
|
|
_attributeName = attributeName;
|
|
}
|
|
|
|
public void OnCompleted()
|
|
{
|
|
_logger.LogInformation("completed one migration for {attribute}", _attributeName);
|
|
}
|
|
|
|
public void OnError(Exception error)
|
|
{
|
|
_logger.LogError("migration error {error} in migration for {attribute}", error, _attributeName);
|
|
}
|
|
|
|
public void OnNext(DocumentInformation value)
|
|
{
|
|
_logger.LogInformation("starting one migration for {attribute} on {documentId}", _attributeName, value.DocumentId);
|
|
}
|
|
} |