Jack
Jack

Reputation: 1493

Use Serilog default ITextFormatter for Serilog.Sinks.AwsCloudWatch

I am using Serilog to log information in my .NET Framework 4.7.2 solution. I am trying to use the Serilog.Sinks.AwsCloudWatch package to log information to AWS CloudWatch.

I have my credentials and other options setup for CloudWatchSinkOptions, except for the TextFormatter property. I do not want to use a custom implementation of ITextFormatter. How can I use the default Serilog formatter that I use in other sinks, such as Serilog.Sinks.EventLog and Serilog.Sinks.Console? I have not had to provide a TextFormatter for any other Serilog Sink and don't want to make one just for this.

I looked at the documentation for Serilog and for the CloudWatch sink, but I could not find any helpful information.

Upvotes: 0

Views: 3142

Answers (1)

Jack
Jack

Reputation: 1493

I found the answer on the GitHub page for Serilog. The default formatter is Serilog.Formatting.Json.JsonFormatter. Instantiating that class and passing it to the AWS CloudWatch sink fixed the issue.

Upvotes: 4

Related Questions