Skip to content

Commit

Permalink
Remove redundant qualifiers (#2342)
Browse files Browse the repository at this point in the history
  • Loading branch information
c0shea authored and 304NotModified committed Oct 13, 2017
1 parent 201acd9 commit 74e6e26
Show file tree
Hide file tree
Showing 287 changed files with 3,751 additions and 3,753 deletions.
38 changes: 19 additions & 19 deletions src/NLog.Extended/Targets/MessageQueueTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ public class MessageQueueTarget : TargetWithLayout
/// </remarks>
public MessageQueueTarget()
{
this.MessageQueueProxy = new MessageQueueProxy();
this.Label = "NLog";
this.Encoding = Encoding.UTF8;
this.CheckIfQueueExists = true;
MessageQueueProxy = new MessageQueueProxy();
Label = "NLog";
Encoding = Encoding.UTF8;
CheckIfQueueExists = true;
}

/// <summary>
Expand All @@ -92,7 +92,7 @@ public MessageQueueTarget()
/// <param name="name">Name of the target.</param>
public MessageQueueTarget(string name) : this()
{
this.Name = name;
Name = name;
}

/// <summary>
Expand Down Expand Up @@ -160,20 +160,20 @@ public MessageQueueTarget(string name) : this()
/// <param name="logEvent">The logging event.</param>
protected override void Write(LogEventInfo logEvent)
{
if (this.Queue == null)
if (Queue == null)
{
return;
}

var queue = this.Queue.Render(logEvent);
var queue = Queue.Render(logEvent);

if (this.CheckIfQueueExists)
if (CheckIfQueueExists)
{
if (!IsFormatNameSyntax(queue) && !this.MessageQueueProxy.Exists(queue))
if (!IsFormatNameSyntax(queue) && !MessageQueueProxy.Exists(queue))
{
if (this.CreateQueueIfNotExists)
if (CreateQueueIfNotExists)
{
this.MessageQueueProxy.Create(queue);
MessageQueueProxy.Create(queue);
}
else
{
Expand All @@ -182,8 +182,8 @@ protected override void Write(LogEventInfo logEvent)
}
}

var msg = this.PrepareMessage(logEvent);
this.MessageQueueProxy.Send(queue, msg);
var msg = PrepareMessage(logEvent);
MessageQueueProxy.Send(queue, msg);
}

/// <summary>
Expand All @@ -199,21 +199,21 @@ protected override void Write(LogEventInfo logEvent)
protected virtual Message PrepareMessage(LogEventInfo logEvent)
{
var msg = new Message();
if (this.Label != null)
if (Label != null)
{
msg.Label = this.Label.Render(logEvent);
msg.Label = Label.Render(logEvent);
}

msg.Recoverable = this.Recoverable;
msg.Priority = this.messagePriority;
msg.Recoverable = Recoverable;
msg.Priority = messagePriority;

if (this.UseXmlEncoding)
if (UseXmlEncoding)
{
msg.Body = Layout.Render(logEvent);
}
else
{
var dataBytes = this.Encoding.GetBytes(this.Layout.Render(logEvent));
var dataBytes = Encoding.GetBytes(Layout.Render(logEvent));

msg.BodyStream.Write(dataBytes, 0, dataBytes.Length);
}
Expand Down
2 changes: 1 addition & 1 deletion src/NLog/Common/AsyncHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace NLog.Common
using System.Collections.Generic;
using System.Text;
using System.Threading;
using NLog.Internal;
using Internal;

/// <summary>
/// Helpers for asynchronous operations.
Expand Down
6 changes: 3 additions & 3 deletions src/NLog/Common/AsyncLogEventInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public struct AsyncLogEventInfo
public AsyncLogEventInfo(LogEventInfo logEvent, AsyncContinuation continuation)
: this()
{
this.LogEvent = logEvent;
this.Continuation = continuation;
LogEvent = logEvent;
Continuation = continuation;
}

/// <summary>
Expand Down Expand Up @@ -105,7 +105,7 @@ public override bool Equals(object obj)
/// </returns>
public override int GetHashCode()
{
return this.LogEvent.GetHashCode() ^ this.Continuation.GetHashCode();
return LogEvent.GetHashCode() ^ Continuation.GetHashCode();
}
}
}
2 changes: 1 addition & 1 deletion src/NLog/Common/InternalLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ private static void CreateDirectoriesIfNeeded(string filename)
{
try
{
if (InternalLogger.LogLevel == NLog.LogLevel.Off)
if (LogLevel == LogLevel.Off)
{
return;
}
Expand Down
58 changes: 29 additions & 29 deletions src/NLog/Common/LogEventInfoBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
namespace NLog.Common
{
using System;
using NLog.Common;
using Common;

/// <summary>
/// A cyclic buffer of <see cref="LogEventInfo"/> object.
Expand All @@ -57,19 +57,19 @@ public class LogEventInfoBuffer
/// <param name="growLimit">The maximum number of items that the buffer can grow to.</param>
public LogEventInfoBuffer(int size, bool growAsNeeded, int growLimit)
{
this._growAsNeeded = growAsNeeded;
this._buffer = new AsyncLogEventInfo[size];
this._growLimit = growLimit;
this._getPointer = 0;
this._putPointer = 0;
_growAsNeeded = growAsNeeded;
_buffer = new AsyncLogEventInfo[size];
_growLimit = growLimit;
_getPointer = 0;
_putPointer = 0;
}

/// <summary>
/// Gets the number of items in the array.
/// </summary>
public int Size
{
get { return this._buffer.Length; }
get { return _buffer.Length; }
}

/// <summary>
Expand All @@ -82,40 +82,40 @@ public int Append(AsyncLogEventInfo eventInfo)
lock (this)
{
// make room for additional item
if (this._count >= this._buffer.Length)
if (_count >= _buffer.Length)
{
if (this._growAsNeeded && this._buffer.Length < this._growLimit)
if (_growAsNeeded && _buffer.Length < _growLimit)
{
// create a new buffer, copy data from current
int newLength = this._buffer.Length * 2;
if (newLength >= this._growLimit)
int newLength = _buffer.Length * 2;
if (newLength >= _growLimit)
{
newLength = this._growLimit;
newLength = _growLimit;
}

// InternalLogger.Trace("Enlarging LogEventInfoBuffer from {0} to {1}", this.buffer.Length, this.buffer.Length * 2);
var newBuffer = new AsyncLogEventInfo[newLength];
Array.Copy(this._buffer, 0, newBuffer, 0, this._buffer.Length);
this._buffer = newBuffer;
Array.Copy(_buffer, 0, newBuffer, 0, _buffer.Length);
_buffer = newBuffer;
}
else
{
// lose the oldest item
this._getPointer = this._getPointer + 1;
_getPointer = _getPointer + 1;
}
}

// put the item
this._putPointer = this._putPointer % this._buffer.Length;
this._buffer[this._putPointer] = eventInfo;
this._putPointer = this._putPointer + 1;
this._count++;
if (this._count >= this._buffer.Length)
_putPointer = _putPointer % _buffer.Length;
_buffer[_putPointer] = eventInfo;
_putPointer = _putPointer + 1;
_count++;
if (_count >= _buffer.Length)
{
this._count = this._buffer.Length;
_count = _buffer.Length;
}

return this._count;
return _count;
}
}

Expand All @@ -127,7 +127,7 @@ public AsyncLogEventInfo[] GetEventsAndClear()
{
lock (this)
{
int cnt = this._count;
int cnt = _count;
if (cnt == 0)
return Internal.ArrayHelper.Empty<AsyncLogEventInfo>();

Expand All @@ -136,15 +136,15 @@ public AsyncLogEventInfo[] GetEventsAndClear()
// InternalLogger.Trace("GetEventsAndClear({0},{1},{2})", this.getPointer, this.putPointer, this.count);
for (int i = 0; i < cnt; ++i)
{
int p = (this._getPointer + i) % this._buffer.Length;
var e = this._buffer[p];
this._buffer[p] = default(AsyncLogEventInfo); // we don't want memory leaks
int p = (_getPointer + i) % _buffer.Length;
var e = _buffer[p];
_buffer[p] = default(AsyncLogEventInfo); // we don't want memory leaks
returnValue[i] = e;
}

this._count = 0;
this._getPointer = 0;
this._putPointer = 0;
_count = 0;
_getPointer = 0;
_putPointer = 0;

return returnValue;
}
Expand Down
10 changes: 5 additions & 5 deletions src/NLog/Conditions/ConditionAndExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ internal sealed class ConditionAndExpression : ConditionExpression
/// <param name="right">Right hand side of the AND expression.</param>
public ConditionAndExpression(ConditionExpression left, ConditionExpression right)
{
this.Left = left;
this.Right = right;
Left = left;
Right = right;
}

/// <summary>
Expand All @@ -68,7 +68,7 @@ public ConditionAndExpression(ConditionExpression left, ConditionExpression righ
/// <returns>A concatenated '(Left) and (Right)' string.</returns>
public override string ToString()
{
return "(" + this.Left + " and " + this.Right + ")";
return "(" + Left + " and " + Right + ")";
}

/// <summary>
Expand All @@ -78,13 +78,13 @@ public override string ToString()
/// <returns>The value of the conjunction operator.</returns>
protected override object EvaluateNode(LogEventInfo context)
{
var bval1 = (bool)this.Left.Evaluate(context);
var bval1 = (bool)Left.Evaluate(context);
if (!bval1)
{
return boxedFalse;
}

var bval2 = (bool)this.Right.Evaluate(context);
var bval2 = (bool)Right.Evaluate(context);
if (!bval2)
{
return boxedFalse;
Expand Down
6 changes: 3 additions & 3 deletions src/NLog/Conditions/ConditionExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
namespace NLog.Conditions
{
using System;
using NLog.Config;
using NLog.Internal;
using Config;
using Internal;

/// <summary>
/// Base class for representing nodes in condition expression trees.
Expand Down Expand Up @@ -65,7 +65,7 @@ public object Evaluate(LogEventInfo context)
{
try
{
return this.EvaluateNode(context);
return EvaluateNode(context);
}
catch (Exception exception)
{
Expand Down
8 changes: 4 additions & 4 deletions src/NLog/Conditions/ConditionLayoutExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

namespace NLog.Conditions
{
using NLog.Layouts;
using Layouts;

/// <summary>
/// Condition layout expression (represented by a string literal
Expand All @@ -47,7 +47,7 @@ internal sealed class ConditionLayoutExpression : ConditionExpression
/// <param name="layout">The layout.</param>
public ConditionLayoutExpression(Layout layout)
{
this.Layout = layout;
Layout = layout;
}

/// <summary>
Expand All @@ -62,7 +62,7 @@ public ConditionLayoutExpression(Layout layout)
/// <returns>String literal in single quotes.</returns>
public override string ToString()
{
return this.Layout.ToString();
return Layout.ToString();
}

/// <summary>
Expand All @@ -73,7 +73,7 @@ public override string ToString()
/// <returns>The value of the layout.</returns>
protected override object EvaluateNode(LogEventInfo context)
{
return this.Layout.Render(context);
return Layout.Render(context);
}
}
}
8 changes: 4 additions & 4 deletions src/NLog/Conditions/ConditionLiteralExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ internal sealed class ConditionLiteralExpression : ConditionExpression
/// <param name="literalValue">Literal value.</param>
public ConditionLiteralExpression(object literalValue)
{
this.LiteralValue = literalValue;
LiteralValue = literalValue;
}

/// <summary>
Expand All @@ -62,12 +62,12 @@ public ConditionLiteralExpression(object literalValue)
/// <returns>The literal value.</returns>
public override string ToString()
{
if (this.LiteralValue == null)
if (LiteralValue == null)
{
return "null";
}

return Convert.ToString(this.LiteralValue, CultureInfo.InvariantCulture);
return Convert.ToString(LiteralValue, CultureInfo.InvariantCulture);
}

/// <summary>
Expand All @@ -77,7 +77,7 @@ public override string ToString()
/// <returns>The literal value as passed in the constructor.</returns>
protected override object EvaluateNode(LogEventInfo context)
{
return this.LiteralValue;
return LiteralValue;
}
}
}
2 changes: 1 addition & 1 deletion src/NLog/Conditions/ConditionMethodAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
namespace NLog.Conditions
{
using System;
using NLog.Config;
using Config;

/// <summary>
/// Marks class as a log event Condition and assigns a name to it.
Expand Down

0 comments on commit 74e6e26

Please sign in to comment.