đLogging
This features uses @totalsoft/apollo-logger which comes with an Apollo logging plugin, that helps you monitor the execution of your GraphQL operations with the use of the request life-cycle events.
This generator wishes to provide an example of saveLogs
implementation that can be found in utils/logging.js
file.
The provided helper function for logging persistence, requires the following __Logs
table to be created in your database.
CREATE TABLE [dbo].[__Logs](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Message] [nvarchar](max) NULL,
[Level] [nvarchar](max) NULL,
[TimeStamp] [datetime] NULL,
[Exception] [nvarchar](max) NULL,
[LogEvent] [nvarchar](max) NULL,
[ServiceName] [varchar](200) NULL,
[TenantId] [uniqueidentifier] NULL,
[CorrelationId] [uniqueidentifier] NULL,
CONSTRAINT [PK___Logs] PRIMARY KEY CLUSTERED ([Id] ASC)
)
In addition, the errors thrown inside Apollo Server, can be wrapped in a 'user friendly message'. This increases the security of your application by making sure there are no sensitive data leaks. To activate this feature, use the securedMessages: true
option when instantiating the plugin:
new ApolloLoggerPlugin({ securedMessages: false })
Last updated