Part of DKNet.Fw.Extensions. Use StringExtensions.SanitizeForLogging before including external text in a log message.
using System;
using DKNet.Fw.Extensions.Primitives;
Console.WriteLine(" order\r\n123\t ".SanitizeForLogging()); // order123
The method removes control characters wherever they occur, then applies Trim(). It returns a new text value without writing to a logger.
ArgumentNullException.