2019-03-25 15:20:54 -04:00
|
|
|
|
using Bit.Core;
|
|
|
|
|
|
using DbUp.Engine.Output;
|
2019-03-25 13:21:05 -04:00
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Bit.Migrator;
|
2022-08-29 16:06:55 -04:00
|
|
|
|
|
2019-03-25 13:21:05 -04:00
|
|
|
|
public class DbUpLogger : IUpgradeLog
|
|
|
|
|
|
{
|
|
|
|
|
|
private readonly ILogger _logger;
|
|
|
|
|
|
|
|
|
|
|
|
public DbUpLogger(ILogger logger)
|
|
|
|
|
|
{
|
2019-03-25 15:20:54 -04:00
|
|
|
|
_logger = logger;
|
2019-03-25 13:21:05 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-09 14:05:26 -07:00
|
|
|
|
public void LogTrace(string format, params object[] args)
|
2019-03-25 13:21:05 -04:00
|
|
|
|
{
|
2025-10-20 11:34:31 -04:00
|
|
|
|
_logger.LogTrace(Constants.BypassFiltersEventId, "{TraceMessage}", string.Format(format, args));
|
2025-01-09 14:05:26 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void LogDebug(string format, params object[] args)
|
|
|
|
|
|
{
|
2025-10-20 11:34:31 -04:00
|
|
|
|
_logger.LogDebug(Constants.BypassFiltersEventId, "{DebugMessage}", string.Format(format, args));
|
2019-03-25 13:21:05 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-09 14:05:26 -07:00
|
|
|
|
public void LogInformation(string format, params object[] args)
|
2022-08-29 15:53:48 -04:00
|
|
|
|
{
|
2025-10-20 11:34:31 -04:00
|
|
|
|
_logger.LogInformation(Constants.BypassFiltersEventId, "{InfoMessage}", string.Format(format, args));
|
2022-08-29 15:53:48 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-09 14:05:26 -07:00
|
|
|
|
public void LogWarning(string format, params object[] args)
|
2019-03-25 13:21:05 -04:00
|
|
|
|
{
|
2025-10-20 11:34:31 -04:00
|
|
|
|
_logger.LogWarning(Constants.BypassFiltersEventId, "{WarningMessage}", string.Format(format, args));
|
2019-03-25 13:21:05 -04:00
|
|
|
|
}
|
2025-01-09 14:05:26 -07:00
|
|
|
|
|
|
|
|
|
|
public void LogError(string format, params object[] args)
|
|
|
|
|
|
{
|
2025-10-20 11:34:31 -04:00
|
|
|
|
_logger.LogError(Constants.BypassFiltersEventId, "{ErrorMessage}", string.Format(format, args));
|
2025-01-09 14:05:26 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void LogError(Exception ex, string format, params object[] args)
|
|
|
|
|
|
{
|
2025-10-20 11:34:31 -04:00
|
|
|
|
_logger.LogError(Constants.BypassFiltersEventId, ex, "{ErrorMessage}", string.Format(format, args));
|
2025-01-09 14:05:26 -07:00
|
|
|
|
}
|
2019-03-25 13:21:05 -04:00
|
|
|
|
}
|