adds some logging befor uploading a file
All checks were successful
PiwigoDirectorySync/pipeline/head This commit looks good
All checks were successful
PiwigoDirectorySync/pipeline/head This commit looks good
This commit is contained in:
parent
8e00c230fc
commit
0670bdd97e
@ -17,7 +17,7 @@ const string outputTemplateFile = "[{Timestamp:HH:mm:ss} {Level}] {SourceContext
|
|||||||
Log.Logger = new LoggerConfiguration().MinimumLevel.Debug()
|
Log.Logger = new LoggerConfiguration().MinimumLevel.Debug()
|
||||||
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
|
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
|
||||||
.MinimumLevel.Override("System", LogEventLevel.Warning)
|
.MinimumLevel.Override("System", LogEventLevel.Warning)
|
||||||
.MinimumLevel.Override("Piwigo.Client", LogEventLevel.Warning)
|
.MinimumLevel.Override("Piwigo.Client", LogEventLevel.Debug)
|
||||||
.Enrich.FromLogContext()
|
.Enrich.FromLogContext()
|
||||||
.WriteTo.Console(LogEventLevel.Information, outputTemplateConsole, theme: AnsiConsoleTheme.Code)
|
.WriteTo.Console(LogEventLevel.Information, outputTemplateConsole, theme: AnsiConsoleTheme.Code)
|
||||||
.WriteTo.File("logs/PiwigoDirectorySync.txt", LogEventLevel.Debug, outputTemplateFile, rollingInterval: RollingInterval.Day, retainedFileCountLimit: 90)
|
.WriteTo.File("logs/PiwigoDirectorySync.txt", LogEventLevel.Debug, outputTemplateFile, rollingInterval: RollingInterval.Day, retainedFileCountLimit: 90)
|
||||||
|
@ -217,6 +217,11 @@ internal class ImageSynchronizer : IImageSynchronizer
|
|||||||
foreach (var imageEntity in imagesToUpload)
|
foreach (var imageEntity in imagesToUpload)
|
||||||
{
|
{
|
||||||
var fileInfo = new FileInfo(Path.Combine(piwigoServer.RootDirectory, imageEntity.FilePath));
|
var fileInfo = new FileInfo(Path.Combine(piwigoServer.RootDirectory, imageEntity.FilePath));
|
||||||
|
|
||||||
|
var fileSizeInKb = fileInfo.Length / 1024f;
|
||||||
|
_logger.Information("Uploading image {ImageFilePath} ({ImageId}) to piwigo server with id {ImageServerImageId} ({Size} KiB)", imageEntity.FilePath, imageEntity.Id,
|
||||||
|
imageEntity.ServerImageId, fileSizeInKb);
|
||||||
|
|
||||||
var imageUpload = GetImageUpload(imageEntity, fileInfo.CreationTime);
|
var imageUpload = GetImageUpload(imageEntity, fileInfo.CreationTime);
|
||||||
var imageUploaded = await piwigoClient.UploadImageAsync(fileInfo, imageUpload, ct);
|
var imageUploaded = await piwigoClient.UploadImageAsync(fileInfo, imageUpload, ct);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user