How do I log PSQL execution progress to a table?

In addition to mechanisms such as:

it is also possible to log progress to a database table.

The following code can serve as a starting point:

--
-- Copy source data to SQL Server.
--
-- create or replace table SyncLogs@sql
-- ( id              guid     not null
-- , occurrence_date datetime not null -- UTC
-- , action_type     char     not null -- 'I', 'D' or 'U' for Insert, Delete or Update, or 'C' for copy, 'S' and 'E' for start and end.
-- , table_name      varchar2     null
-- , nk1             varchar2     null -- First element of business key.
-- , nk2             varchar2     null
-- , nk3             varchar2     null
-- , nk4             varchar2     null
-- , nk5             varchar2     null
-- , label           varchar2     null -- Textual background.
-- , actions         varchar2     null -- Changed values.
-- --
-- , ip_address      varchar2 not null -- Audit fields.
-- , iuid            varchar2 not null
-- , date_created    datetime not null
-- , created_by      varchar2 not null
-- , created_at      varchar2 not null
-- , session_created varchar2 not null
-- )

begin
  --
  -- Start process.
  --
  insert into SYNCLOGS@sql
  ( id
  , occurrence_date
  , action_type
  , table_name
  , label
  , actions
  --
  , ip_address
  , iuid
  , date_created
  , created_by
  , created_at
  , session_created
  )
  values
  ( newid()
  , sysdateutc
  , 'S'
  , null
  , 'Start'
  , null
  --
  , sys_context('USERENV', 'CLIENT_IP_ADDRESS_EXTERNAL', 'mc')
  , sys_context('USERENV', 'IUID', 'mc')
  , sysdateutc
  , sys_context('USERENV', 'CURRENT_USER', 'mc')
  , sys_context('USERENV', 'APPLICATION_FULL', 'mc')
  , sys_context('USERENV', 'SESSIONID', 'mc')
  );
  --
  create or replace table mc_dpersoneel@sql
  as
  select *
  from   dpersoneel@mc
  ;
  --
  -- Register copy action.
  --
  insert into SYNCLOGS@mss
  ( id
  , occurrence_date
  , action_type
  , table_name
  , label
  , actions
  --
  , ip_address
  , iuid
  , date_created
  , created_by
  , created_at
  , session_created
  )
  values
  ( newid()
  , sysdateutc
  , 'C'
  , 'mc_dpersoneel@sql'
  , 'Created'
  , to_char(sqlrowcount) || ' rows'
  --
  , sys_context('USERENV', 'CLIENT_IP_ADDRESS_EXTERNAL', 'mc')
  , sys_context('USERENV', 'IUID', 'mc')
  , sysdateutc
  , sys_context('USERENV', 'CURRENT_USER', 'mc')
  , sys_context('USERENV', 'APPLICATION_FULL', 'mc')
  , sys_context('USERENV', 'SESSIONID', 'mc')
  );
  --
  -- End process.
  --
  insert into SYNCLOGS@mss
  ( id
  , occurrence_date
  , action_type
  , table_name
  , label
  , actions
  --
  , ip_address
  , iuid
  , date_created
  , created_by
  , created_at
  , session_created
  )
  values
  ( newid()
  , sysdateutc
  , 'E'
  , null
  , 'Finished'
  , null
  --
  , sys_context('USERENV', 'CLIENT_IP_ADDRESS_EXTERNAL', 'mc')
  , sys_context('USERENV', 'IUID', 'mc')
  , sysdateutc
  , sys_context('USERENV', 'CURRENT_USER', 'mc')
  , sys_context('USERENV', 'APPLICATION_FULL', 'mc')
  , sys_context('USERENV', 'SESSIONID', 'mc')
  );
end;