You wouldn’t use triggers to log errors into the SQL Server. You would need to put code into the stored procedures that make up your application to log any errors which are encountered.
REGISTER or login:
Some statement which fails.
INSERT INTO LogTable
(ErrorMessage, ErrorNumber, ...)
SELECT ERROR_MESSAGE(), ERROR_NUMBER(), ...
IF @@TRANCOUNT <> 0