You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

116 lines
2.6 KiB

using System;
using System.Text;
namespace Sog.Log
{
public class BDCLogHelper
{
private StringBuilder sb;
public BDCLogHelper(int eventId)
{
sb = new StringBuilder();
sb.Append("event_id=");
sb.Append(eventId);
}
public void Append(string name, bool value)
{
sb.Append("|");
sb.Append(name);
sb.Append("=");
sb.Append(value ? 1 : 0);
}
public void Append(string name, sbyte value)
{
sb.Append("|");
sb.Append(name);
sb.Append("=");
sb.Append(value);
}
public void Append(string name, byte value)
{
sb.Append("|");
sb.Append(name);
sb.Append("=");
sb.Append(value);
}
public void Append(string name, Int16 value)
{
sb.Append("|");
sb.Append(name);
sb.Append("=");
sb.Append(value);
}
public void Append(string name, UInt16 value)
{
sb.Append("|");
sb.Append(name);
sb.Append("=");
sb.Append(value);
}
public void Append(string name, int value)
{
sb.Append("|");
sb.Append(name);
sb.Append("=");
sb.Append(value);
}
public void Append(string name, uint value)
{
sb.Append("|");
sb.Append(name);
sb.Append("=");
sb.Append(value);
}
public void Append(string name, Int64 value)
{
sb.Append("|");
sb.Append(name);
sb.Append("=");
sb.Append(value);
}
public void Append(string name, UInt64 value)
{
sb.Append("|");
sb.Append(name);
sb.Append("=");
sb.Append(value);
}
public void Append(string name, string value)
{
sb.Append("|");
sb.Append(name);
sb.Append("=");
if (value != null)
{
sb.Append(value);
}
}
public void Append(string name, ReadOnlySpan<char> ptrValue)
{
sb.Append("|");
sb.Append(name);
sb.Append("=");
if (ptrValue.IsEmpty == false)
{
sb.Append(ptrValue);
}
}
public override string ToString()
{
return sb.ToString();
}
}
}