Rename Logger.Debug to Logger.LogDebug across codebase

Renamed the Logger.Debug method to Logger.LogDebug for improved clarity and consistency. Updated all usages in PDFBurner, ReportCreator, FinalizeDocumentJob, TempFiles, and Logging.cs. No changes to logging logic or other log levels.
This commit is contained in:
2026-02-25 13:36:50 +01:00
parent 3b06f3fdac
commit cbc983e070
5 changed files with 43 additions and 41 deletions

View File

@@ -185,7 +185,7 @@ public class PDFBurner : BaseClass
foreach (var annotation in annotationData.annotations) foreach (var annotation in annotationData.annotations)
{ {
Logger.Debug("Adding AnnotationID: " + annotation.id); Logger.LogDebug("Adding AnnotationID: " + annotation.id);
switch (annotation.type) switch (annotation.type)
{ {

View File

@@ -23,7 +23,7 @@ public class ReportCreator : BaseClass
{ {
try try
{ {
Logger.Debug("Loading report data.."); Logger.LogDebug("Loading report data..");
var table = _reportModel.List(envelope.Id); var table = _reportModel.List(envelope.Id);
var items = GetReportSource(table); var items = GetReportSource(table);
@@ -34,9 +34,9 @@ public class ReportCreator : BaseClass
throw new CreateReportException("No report data found!"); throw new CreateReportException("No report data found!");
} }
Logger.Debug("Creating report with [{0}] items..", items.Count); Logger.LogDebug("Creating report with [{0}] items..", items.Count);
var buffer = DoCreateReport(items); var buffer = DoCreateReport(items);
Logger.Debug("Report created!"); Logger.LogDebug("Report created!");
return buffer; return buffer;
} }
@@ -49,7 +49,7 @@ public class ReportCreator : BaseClass
private List<ReportItem> GetReportSource(DataTable dataTable) private List<ReportItem> GetReportSource(DataTable dataTable)
{ {
Logger.Debug("Preparing report data"); Logger.LogDebug("Preparing report data");
return dataTable.Rows return dataTable.Rows
.Cast<DataRow>() .Cast<DataRow>()
.Select(ToReportItem) .Select(ToReportItem)
@@ -63,14 +63,14 @@ public class ReportCreator : BaseClass
var source = new ReportSource { Items = items }; var source = new ReportSource { Items = items };
var report = new rptEnvelopeHistory { DataSource = source, DataMember = "Items" }; var report = new rptEnvelopeHistory { DataSource = source, DataMember = "Items" };
Logger.Debug("Creating report in memory.."); Logger.LogDebug("Creating report in memory..");
report.CreateDocument(); report.CreateDocument();
Logger.Debug("Exporting report to stream.."); Logger.LogDebug("Exporting report to stream..");
using var stream = new MemoryStream(); using var stream = new MemoryStream();
report.ExportToPdf(stream); report.ExportToPdf(stream);
Logger.Debug("Writing report to buffer.."); Logger.LogDebug("Writing report to buffer..");
return stream.ToArray(); return stream.ToArray();
} }

View File

@@ -57,43 +57,43 @@ public class FinalizeDocumentJob(IOptions<WorkerOptions> options, IConfiguration
_tempFiles = new TempFiles(_logConfig); _tempFiles = new TempFiles(_logConfig);
_tempFiles.Create(); _tempFiles.Create();
var jobId = typeof(FinalizeDocumentJob).FullName; var jobId = typeof(FinalizeDocumentJob).FullName;
_logger.Debug("Starting job {0}", jobId); _logger.LogDebug("Starting job {0}", jobId);
try try
{ {
_logger.Debug("Loading GdViewer.."); _logger.LogDebug("Loading GdViewer..");
_gdViewer = new GdViewer(); _gdViewer = new GdViewer();
_licenseManager.RegisterKEY(gdPictureKey); _licenseManager.RegisterKEY(gdPictureKey);
_logger.Debug("Loading Database.."); _logger.LogDebug("Loading Database..");
var connectionString = config.GetConnectionString("Default") ?? throw new InvalidOperationException("Connection string 'Default' not found."); var connectionString = config.GetConnectionString("Default") ?? throw new InvalidOperationException("Connection string 'Default' not found.");
_databaseConnectionString = MSSQLServer.DecryptConnectionString(connectionString); _databaseConnectionString = MSSQLServer.DecryptConnectionString(connectionString);
_database = new MSSQLServer(_logConfig, _databaseConnectionString); _database = new MSSQLServer(_logConfig, _databaseConnectionString);
_logger.Debug("Loading Models & Services"); _logger.LogDebug("Loading Models & Services");
var state = GetState(); var state = GetState();
InitializeModels(state); InitializeModels(state);
_logger.Debug("Loading Configuration.."); _logger.LogDebug("Loading Configuration..");
_config = _configModel?.LoadConfiguration() ?? new DbConfig(); _config = _configModel?.LoadConfiguration() ?? new DbConfig();
state.DbConfig = _config; state.DbConfig = _config;
InitializeServices(state); InitializeServices(state);
_logger.Debug("Loading PDFBurner.."); _logger.LogDebug("Loading PDFBurner..");
var pdfBurnerParams = _options.PdfBurner; var pdfBurnerParams = _options.PdfBurner;
_pdfBurner = new PDFBurner(_logConfig, gdPictureKey, pdfBurnerParams, _databaseConnectionString); _pdfBurner = new PDFBurner(_logConfig, gdPictureKey, pdfBurnerParams, _databaseConnectionString);
_logger.Debug("Loading PDFMerger.."); _logger.LogDebug("Loading PDFMerger..");
_pdfMerger = new PDFMerger(_logConfig, gdPictureKey); _pdfMerger = new PDFMerger(_logConfig, gdPictureKey);
_logger.Debug("Loading ReportCreator.."); _logger.LogDebug("Loading ReportCreator..");
_reportCreator = new ReportCreator(_logConfig, state); _reportCreator = new ReportCreator(_logConfig, state);
_config.DocumentPath = _config.DocumentPath; _config.DocumentPath = _config.DocumentPath;
_logger.Debug("DocumentPath: [{0}]", _config.DocumentPath); _logger.LogDebug("DocumentPath: [{0}]", _config.DocumentPath);
_logger.Debug("ExportPath: [{0}]", _config.ExportPath); _logger.LogDebug("ExportPath: [{0}]", _config.ExportPath);
var completeStatus = EnvelopeStatus.EnvelopeCompletelySigned; var completeStatus = EnvelopeStatus.EnvelopeCompletelySigned;
var sql = $"SELECT * FROM TBSIG_ENVELOPE WHERE STATUS = {completeStatus} AND DATEDIFF(minute, CHANGED_WHEN, GETDATE()) >= {CompleteWaitTime} ORDER BY GUID"; var sql = $"SELECT * FROM TBSIG_ENVELOPE WHERE STATUS = {completeStatus} AND DATEDIFF(minute, CHANGED_WHEN, GETDATE()) >= {CompleteWaitTime} ORDER BY GUID";
@@ -123,7 +123,7 @@ public class FinalizeDocumentJob(IOptions<WorkerOptions> options, IConfiguration
throw new ArgumentNullException(nameof(EnvelopeData)); throw new ArgumentNullException(nameof(EnvelopeData));
} }
_logger.Debug("Loading Envelope Data.."); _logger.LogDebug("Loading Envelope Data..");
var envelopeData = GetEnvelopeData(id); var envelopeData = GetEnvelopeData(id);
if (envelopeData is null) if (envelopeData is null)
@@ -132,7 +132,7 @@ public class FinalizeDocumentJob(IOptions<WorkerOptions> options, IConfiguration
throw new ArgumentNullException(nameof(EnvelopeData)); throw new ArgumentNullException(nameof(EnvelopeData));
} }
_logger.Debug("Burning Annotations to pdf ..."); _logger.LogDebug("Burning Annotations to pdf ...");
var burnedDocument = BurnAnnotationsToPdf(envelopeData); var burnedDocument = BurnAnnotationsToPdf(envelopeData);
if (burnedDocument is null) if (burnedDocument is null)
{ {
@@ -146,24 +146,24 @@ public class FinalizeDocumentJob(IOptions<WorkerOptions> options, IConfiguration
throw new ApplicationException("Document Report could not be created"); throw new ApplicationException("Document Report could not be created");
} }
_logger.Debug("Creating report.."); _logger.LogDebug("Creating report..");
var report = _reportCreator!.CreateReport(envelope); var report = _reportCreator!.CreateReport(envelope);
_logger.Debug("Report created!"); _logger.LogDebug("Report created!");
_logger.Debug("Merging documents ..."); _logger.LogDebug("Merging documents ...");
var mergedDocument = _pdfMerger!.MergeDocuments(burnedDocument, report); var mergedDocument = _pdfMerger!.MergeDocuments(burnedDocument, report);
_logger.Debug("Documents merged!"); _logger.LogDebug("Documents merged!");
var outputDirectoryPath = Path.Combine(_config.ExportPath, _parentFolderUid); var outputDirectoryPath = Path.Combine(_config.ExportPath, _parentFolderUid);
_logger.Debug("oOutputDirectoryPath is {0}", outputDirectoryPath); _logger.LogDebug("oOutputDirectoryPath is {0}", outputDirectoryPath);
if (!Directory.Exists(outputDirectoryPath)) if (!Directory.Exists(outputDirectoryPath))
{ {
_logger.Debug("Directory not existing. Creating ... "); _logger.LogDebug("Directory not existing. Creating ... ");
Directory.CreateDirectory(outputDirectoryPath); Directory.CreateDirectory(outputDirectoryPath);
} }
var outputFilePath = Path.Combine(outputDirectoryPath, $"{envelope.Uuid}.pdf"); var outputFilePath = Path.Combine(outputDirectoryPath, $"{envelope.Uuid}.pdf");
_logger.Debug("Writing finalized Pdf to disk.."); _logger.LogDebug("Writing finalized Pdf to disk..");
_logger.Info("Output path is [{0}]", outputFilePath); _logger.Info("Output path is [{0}]", outputFilePath);
try try
@@ -176,7 +176,7 @@ public class FinalizeDocumentJob(IOptions<WorkerOptions> options, IConfiguration
throw new ExportDocumentException("Could not export final document to disk!", ex); throw new ExportDocumentException("Could not export final document to disk!", ex);
} }
_logger.Debug("Writing EB-bytes to database..."); _logger.LogDebug("Writing EB-bytes to database...");
UpdateFileDb(outputFilePath, envelope.Id); UpdateFileDb(outputFilePath, envelope.Id);
if (!SendFinalEmails(envelope)) if (!SendFinalEmails(envelope))
@@ -186,7 +186,7 @@ public class FinalizeDocumentJob(IOptions<WorkerOptions> options, IConfiguration
_logger.Info("Report-mails successfully sent!"); _logger.Info("Report-mails successfully sent!");
_logger.Debug("Setting envelope status.."); _logger.LogDebug("Setting envelope status..");
if (_actionService?.FinalizeEnvelope(envelope) == false) if (_actionService?.FinalizeEnvelope(envelope) == false)
{ {
_logger.Warn("Envelope could not be finalized!"); _logger.Warn("Envelope could not be finalized!");
@@ -203,7 +203,7 @@ public class FinalizeDocumentJob(IOptions<WorkerOptions> options, IConfiguration
_logger.Info("Envelope [{0}] finalized!", id); _logger.Info("Envelope [{0}] finalized!", id);
} }
_logger.Debug("Completed job {0} successfully!", jobId); _logger.LogDebug("Completed job {0} successfully!", jobId);
} }
catch (MergeDocumentException ex) catch (MergeDocumentException ex)
{ {
@@ -222,7 +222,7 @@ public class FinalizeDocumentJob(IOptions<WorkerOptions> options, IConfiguration
} }
finally finally
{ {
_logger.Debug("Job execution for [{0}] ended", jobId); _logger.LogDebug("Job execution for [{0}] ended", jobId);
} }
return Task.FromResult(true); return Task.FromResult(true);
@@ -265,7 +265,7 @@ public class FinalizeDocumentJob(IOptions<WorkerOptions> options, IConfiguration
if (mailToCreator != FinalEmailType.No) if (mailToCreator != FinalEmailType.No)
{ {
_logger?.Debug("Sending email to creator ..."); _logger?.LogDebug("Sending email to creator ...");
SendFinalEmailToCreator(envelope, mailToCreator); SendFinalEmailToCreator(envelope, mailToCreator);
} }
else else
@@ -275,7 +275,7 @@ public class FinalizeDocumentJob(IOptions<WorkerOptions> options, IConfiguration
if (mailToReceivers != FinalEmailType.No) if (mailToReceivers != FinalEmailType.No)
{ {
_logger?.Debug("Sending emails to receivers.."); _logger?.LogDebug("Sending emails to receivers..");
SendFinalEmailToReceivers(envelope, mailToReceivers); SendFinalEmailToReceivers(envelope, mailToReceivers);
} }
else else
@@ -289,7 +289,7 @@ public class FinalizeDocumentJob(IOptions<WorkerOptions> options, IConfiguration
private bool SendFinalEmailToCreator(Envelope envelope, FinalEmailType mailToCreator) private bool SendFinalEmailToCreator(Envelope envelope, FinalEmailType mailToCreator)
{ {
var includeAttachment = SendFinalEmailWithAttachment(mailToCreator); var includeAttachment = SendFinalEmailWithAttachment(mailToCreator);
_logger?.Debug("Attachment included: [{0}]", includeAttachment); _logger?.LogDebug("Attachment included: [{0}]", includeAttachment);
if (_actionService?.CompleteEnvelope(envelope) == false) if (_actionService?.CompleteEnvelope(envelope) == false)
{ {
@@ -303,7 +303,7 @@ public class FinalizeDocumentJob(IOptions<WorkerOptions> options, IConfiguration
private bool SendFinalEmailToReceivers(Envelope envelope, FinalEmailType mailToReceivers) private bool SendFinalEmailToReceivers(Envelope envelope, FinalEmailType mailToReceivers)
{ {
var includeAttachment = SendFinalEmailWithAttachment(mailToReceivers); var includeAttachment = SendFinalEmailWithAttachment(mailToReceivers);
_logger?.Debug("Attachment included: [{0}]", includeAttachment); _logger?.LogDebug("Attachment included: [{0}]", includeAttachment);
foreach (var receiver in envelope.EnvelopeReceivers ?? Enumerable.Empty<EnvelopeReceiver>()) foreach (var receiver in envelope.EnvelopeReceivers ?? Enumerable.Empty<EnvelopeReceiver>())
{ {
@@ -336,9 +336,9 @@ public class FinalizeDocumentJob(IOptions<WorkerOptions> options, IConfiguration
} }
else else
{ {
_logger?.Debug("we got bytes.."); _logger?.LogDebug("we got bytes..");
inputPath = _config!.DocumentPathOrigin; inputPath = _config!.DocumentPathOrigin;
_logger?.Debug("oInputPath: {0}", _config.DocumentPathOrigin); _logger?.LogDebug("oInputPath: {0}", _config.DocumentPathOrigin);
} }
if (envelopeData.DocAsByte is null) if (envelopeData.DocAsByte is null)
@@ -393,7 +393,7 @@ public class FinalizeDocumentJob(IOptions<WorkerOptions> options, IConfiguration
EnvelopeUuid = row.ItemEx("ENVELOPE_UUID", string.Empty) EnvelopeUuid = row.ItemEx("ENVELOPE_UUID", string.Empty)
}; };
_logger?.Debug("Document path: [{0}]", data.DocumentPath); _logger?.LogDebug("Document path: [{0}]", data.DocumentPath);
return data; return data;
} }

View File

@@ -11,7 +11,9 @@ public class LogConfig
public class Logger public class Logger
{ {
public void Debug(string message, params object?[] args) => Write("DEBUG", message, args); ILogger<LogConfig> logger;
public void LogDebug(string message, params object?[] args) => Write("DEBUG", message, args);
public void Info(string message, params object?[] args) => Write("INFO", message, args); public void Info(string message, params object?[] args) => Write("INFO", message, args);
public void Warn(string message, params object?[] args) => Write("WARN", message, args); public void Warn(string message, params object?[] args) => Write("WARN", message, args);
public void Warn(Exception exception, string message, params object?[] args) => Write("WARN", message + " " + exception.Message, args); public void Warn(Exception exception, string message, params object?[] args) => Write("WARN", message + " " + exception.Message, args);

View File

@@ -42,7 +42,7 @@ public class TempFiles : BaseClass
{ {
foreach (var fileItem in Directory.GetFiles(TempPath)) foreach (var fileItem in Directory.GetFiles(TempPath))
{ {
Logger.Debug("Deleting tempPath-file: {0} ...", fileItem); Logger.LogDebug("Deleting tempPath-file: {0} ...", fileItem);
File.Delete(fileItem); File.Delete(fileItem);
} }
@@ -59,7 +59,7 @@ public class TempFiles : BaseClass
{ {
try try
{ {
Logger.Debug("Deleting tempPath-Data: {0} ...", TempPath); Logger.LogDebug("Deleting tempPath-Data: {0} ...", TempPath);
Directory.Delete(TempPath, true); Directory.Delete(TempPath, true);
return true; return true;
} }