Need some assistance on creating custom logging directory per profile

English Support for Syncovery on Windows.
Post Reply
Ramon_leid
Posts: 1
Joined: Tue Jul 11, 2023 7:25 pm

Need some assistance on creating custom logging directory per profile

Post by Ramon_leid »

Hi there,

This is the scenario we have.

We have multiple profiles that run on intervals sending emails containing the transfer logs however our userbase prefers to have a logfile generated and saved on a UNC path due to their workflow.

We need to have some way to generate a log when a profile successfully completes containing the list of files/folders transferred along with their files size ( basically what's in the email logs) but have that placed into a UNC path per profile (since it differs per profile).

Any assistance with this would be appreciated.

tobias
Posts: 1668
Joined: Tue Mar 31, 2020 7:37 pm

Re: Need some assistance on creating custom logging directory per profile

Post by tobias »

Hello,
in the latest Syncovery version, you can have the log file be copied to another path when a job has completed:

Code: Select all

function OnLogFileClosed(const FileName:UnicodeString):Boolean;
begin
  FileCopy(FileName,'E:\Tests\'+ExtractFileName(FileName));
  Result:=true;
  end;
You can also do custom logging:

Code: Select all

const LogFolder='C:\Tests\Logs';
      LogName='SyncoveryLog.csv';

function OnActionComplete(const StartTimeUTC, CompletionTimeUTC: Double;
        const Success: Boolean;
        const ActionStr, DirectionStr, Filename,
              LeftFile, RightFile, Subfolder, MovedTo,
              ErrorMsg: UnicodeString;
        const ResultCode: Int64;
        const ErrorSide: UnicodeString;
        const ASize,ACompressedSize:Int64):Boolean;
var TF:Opaque;
begin
  MakeSurePathExists(LogOrdner,false);
  AtomicAppendTextFileLine(LogFolder+'\'+LogName,
          DateToStr(Now)+';"'+Subfolder+'";"'+Filename+'";'+IntToStr(ASize));
  Result:=true;
  end;
PascalScripts can be added to the profile via the Job tab sheet -> PascalScript.

Or globally via Program Settings dialog -> Advanced -> Global PascalScript.

Post Reply