Skip to content

Commit

Permalink
Switch around maxAllowedMessageLength comparisons for better readability
Browse files Browse the repository at this point in the history
  • Loading branch information
andypeeters authored and ckadluba committed Jun 17, 2022
1 parent a4e6a87 commit 01b5da0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private string RenderLogMessage(LogEvent logEvent)
var logMessage = logEvent.RenderMessage(_formatProvider);
var maxAllowedMessageLength = _columnOptions.Message.DataLength;

if (0 < maxAllowedMessageLength && logMessage.Length > maxAllowedMessageLength)
if (maxAllowedMessageLength > 0 && logMessage.Length > maxAllowedMessageLength)
{
logMessage = logMessage.Substring(0, maxAllowedMessageLength - 3);
logMessage = $"{logMessage}...";
Expand All @@ -81,7 +81,7 @@ private string TrimMessageTemplate(LogEvent logEvent)
var messageTemplate = logEvent.MessageTemplate.Text;
var maxAllowedMessageTemplateLength = _columnOptions.MessageTemplate.DataLength;

if (0 < maxAllowedMessageTemplateLength && messageTemplate.Length > maxAllowedMessageTemplateLength)
if (maxAllowedMessageTemplateLength > 0 && messageTemplate.Length > maxAllowedMessageTemplateLength)
{
messageTemplate = messageTemplate.Substring(0, maxAllowedMessageTemplateLength - 3);
messageTemplate = $"{messageTemplate}...";
Expand Down

0 comments on commit 01b5da0

Please sign in to comment.