Struct FormatterStruct
Interface that describes how to convert some object context into string
Implements
Inherited Members
Namespace: Unity.Logging
Assembly: Unity.Logging.dll
Syntax
public struct FormatterStruct : IFormatter
Fields
OnFormatMessage
Converts a Log
Declaration
public OnLogMessageFormatterDelegate OnFormatMessage
Field Value
Type | Description |
---|---|
On |
UseTextBlittable
It is a JSON formatter if 1, text if 0
Declaration
public byte UseTextBlittable
Field Value
Type | Description |
---|---|
byte |
Properties
IsCreated
True if the structure was initialized
Declaration
public bool IsCreated { get; }
Property Value
Type | Description |
---|---|
bool |
UseText
Checks if this is a JSON or text formatter
Declaration
public bool UseText { get; set; }
Property Value
Type | Description |
---|---|
bool | Returns true if this is a text formatter, false if JSON |
Methods
AfterObject(ref UnsafeText)
Object ends. Should be called after Before
Declaration
public bool AfterObject(ref UnsafeText output)
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
Returns
Type | Description |
---|---|
bool | True if successful |
AppendDelimiter(ref UnsafeText)
Append a delimiter if any between properties / objects
Declaration
public bool AppendDelimiter(ref UnsafeText output)
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
Returns
Type | Description |
---|---|
bool | True if successful |
BeforeObject(ref UnsafeText)
Object begins. Should be called before After
Declaration
public bool BeforeObject(ref UnsafeText output)
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
Returns
Type | Description |
---|---|
bool | True if successful |
BeginProperty(ref UnsafeText, string)
Property starts. Should be called before End
Declaration
public bool BeginProperty(ref UnsafeText output, string fieldName)
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
string | fieldName | Name of the field that can be used by formatter |
Returns
Type | Description |
---|---|
bool | True if successful |
BeginProperty<T>(ref UnsafeText, ref T)
Property starts. Should be called before End
Declaration
public bool BeginProperty<T>(ref UnsafeText output, ref T fieldName) where T : unmanaged, IUTF8Bytes, INativeList<byte>
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
T | fieldName | Name of the field that can be used by formatter |
Returns
Type | Description |
---|---|
bool | True if successful |
Type Parameters
Name | Description |
---|---|
T | Unmanaged UTF8 string |
EndProperty(ref UnsafeText, string)
Property ends. Should be called after Begin
Declaration
public bool EndProperty(ref UnsafeText output, string fieldName)
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
string | fieldName | Name of the field that can be used by formatter |
Returns
Type | Description |
---|---|
bool | True if successful |
EndProperty<T>(ref UnsafeText, ref T)
Property ends. Should be called after Begin
Declaration
public bool EndProperty<T>(ref UnsafeText output, ref T fieldName) where T : unmanaged, IUTF8Bytes, INativeList<byte>
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
T | fieldName | Name of the field that can be used by formatter |
Returns
Type | Description |
---|---|
bool | True if successful |
Type Parameters
Name | Description |
---|---|
T | Unmanaged UTF8 string |
WriteChild<T>(ref UnsafeText, string, ref T, ref LogMemoryManager, ref ArgumentInfo, int)
Writes a child mirror struct as a property
Declaration
public bool WriteChild<T>(ref UnsafeText output, string fieldName, ref T field, ref LogMemoryManager memAllocator, ref ArgumentInfo currArgSlot, int depth) where T : unmanaged, ILoggableMirrorStruct
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
string | fieldName | Name of the field that can be used by formatter |
T | field | Child mirror struct to write |
Log |
memAllocator | |
Argument |
currArgSlot | Hole that was used to describe the struct in the log message, for instance |
int | depth |
Returns
Type | Description |
---|---|
bool | True if successful |
Type Parameters
Name | Description |
---|---|
T | Child mirror struct - unmanaged, ILoggableMirrorStruct |
WriteProperty(ref UnsafeText, string, bool, ref ArgumentInfo)
Writes bool as a property
Declaration
public bool WriteProperty(ref UnsafeText output, string fieldName, bool b, ref ArgumentInfo currArgSlot)
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
string | fieldName | Name of the field that can be used by formatter |
bool | b | Bool to write |
Argument |
currArgSlot | Hole that was used to describe the struct in the log message, for instance |
Returns
Type | Description |
---|---|
bool | True if successful |
WriteProperty(ref UnsafeText, string, byte, ref ArgumentInfo)
Writes byte as a property
Declaration
public bool WriteProperty(ref UnsafeText output, string fieldName, byte c, ref ArgumentInfo currArgSlot)
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
string | fieldName | Name of the field that can be used by formatter |
byte | c | Byte to write |
Argument |
currArgSlot | Hole that was used to describe the struct in the log message, for instance |
Returns
Type | Description |
---|---|
bool | True if successful |
WriteProperty(ref UnsafeText, string, char, ref ArgumentInfo)
Writes char as a property
Declaration
public bool WriteProperty(ref UnsafeText output, string fieldName, char c, ref ArgumentInfo currArgSlot)
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
string | fieldName | Name of the field that can be used by formatter |
char | c | Char to write |
Argument |
currArgSlot | Hole that was used to describe the struct in the log message, for instance |
Returns
Type | Description |
---|---|
bool | True if successful |
WriteProperty(ref UnsafeText, string, decimal, ref ArgumentInfo)
Writes decimal as a property
Declaration
public bool WriteProperty(ref UnsafeText output, string fieldName, decimal c, ref ArgumentInfo currArgSlot)
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
string | fieldName | Name of the field that can be used by formatter |
decimal | c | Decimal to write |
Argument |
currArgSlot | Hole that was used to describe the struct in the log message, for instance |
Returns
Type | Description |
---|---|
bool | True if successful |
WriteProperty(ref UnsafeText, string, double, ref ArgumentInfo)
Writes double as a property
Declaration
public bool WriteProperty(ref UnsafeText output, string fieldName, double c, ref ArgumentInfo currArgSlot)
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
string | fieldName | Name of the field that can be used by formatter |
double | c | Double to write |
Argument |
currArgSlot | Hole that was used to describe the struct in the log message, for instance |
Returns
Type | Description |
---|---|
bool | True if successful |
WriteProperty(ref UnsafeText, string, short, ref ArgumentInfo)
Writes short as a property
Declaration
public bool WriteProperty(ref UnsafeText output, string fieldName, short c, ref ArgumentInfo currArgSlot)
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
string | fieldName | Name of the field that can be used by formatter |
short | c | Short to write |
Argument |
currArgSlot | Hole that was used to describe the struct in the log message, for instance |
Returns
Type | Description |
---|---|
bool | True if successful |
WriteProperty(ref UnsafeText, string, int, ref ArgumentInfo)
Writes int as a property
Declaration
public bool WriteProperty(ref UnsafeText output, string fieldName, int c, ref ArgumentInfo currArgSlot)
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
string | fieldName | Name of the field that can be used by formatter |
int | c | Int to write |
Argument |
currArgSlot | Hole that was used to describe the struct in the log message, for instance |
Returns
Type | Description |
---|---|
bool | True if successful |
WriteProperty(ref UnsafeText, string, long, ref ArgumentInfo)
Writes long as a property
Declaration
public bool WriteProperty(ref UnsafeText output, string fieldName, long c, ref ArgumentInfo currArgSlot)
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
string | fieldName | Name of the field that can be used by formatter |
long | c | Long to write |
Argument |
currArgSlot | Hole that was used to describe the struct in the log message, for instance |
Returns
Type | Description |
---|---|
bool | True if successful |
WriteProperty(ref UnsafeText, string, IntPtr, ref ArgumentInfo)
Writes IntPtr as a property
Declaration
public bool WriteProperty(ref UnsafeText output, string fieldName, IntPtr p, ref ArgumentInfo currArgSlot)
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
string | fieldName | Name of the field that can be used by formatter |
Int |
p | IntPtr to write |
Argument |
currArgSlot | Hole that was used to describe the struct in the log message, for instance |
Returns
Type | Description |
---|---|
bool | True if successful |
WriteProperty(ref UnsafeText, string, sbyte, ref ArgumentInfo)
Writes sbyte as a property
Declaration
public bool WriteProperty(ref UnsafeText output, string fieldName, sbyte c, ref ArgumentInfo currArgSlot)
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
string | fieldName | Name of the field that can be used by formatter |
sbyte | c | SByte to write |
Argument |
currArgSlot | Hole that was used to describe the struct in the log message, for instance |
Returns
Type | Description |
---|---|
bool | True if successful |
WriteProperty(ref UnsafeText, string, float, ref ArgumentInfo)
Writes float as a property
Declaration
public bool WriteProperty(ref UnsafeText output, string fieldName, float c, ref ArgumentInfo currArgSlot)
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
string | fieldName | Name of the field that can be used by formatter |
float | c | Primitive to write |
Argument |
currArgSlot | Hole that was used to describe the struct in the log message, for instance |
Returns
Type | Description |
---|---|
bool | True if successful |
WriteProperty(ref UnsafeText, string, ushort, ref ArgumentInfo)
Writes ushort as a property
Declaration
public bool WriteProperty(ref UnsafeText output, string fieldName, ushort c, ref ArgumentInfo currArgSlot)
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
string | fieldName | Name of the field that can be used by formatter |
ushort | c | UShort to write |
Argument |
currArgSlot | Hole that was used to describe the struct in the log message, for instance |
Returns
Type | Description |
---|---|
bool | True if successful |
WriteProperty(ref UnsafeText, string, uint, ref ArgumentInfo)
Writes uint as a property
Declaration
public bool WriteProperty(ref UnsafeText output, string fieldName, uint c, ref ArgumentInfo currArgSlot)
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
string | fieldName | Name of the field that can be used by formatter |
uint | c | UInt to write |
Argument |
currArgSlot | Hole that was used to describe the struct in the log message, for instance |
Returns
Type | Description |
---|---|
bool | True if successful |
WriteProperty(ref UnsafeText, string, ulong, ref ArgumentInfo)
Writes ulong as a property
Declaration
public bool WriteProperty(ref UnsafeText output, string fieldName, ulong c, ref ArgumentInfo currArgSlot)
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
string | fieldName | Name of the field that can be used by formatter |
ulong | c | ULong to write |
Argument |
currArgSlot | Hole that was used to describe the struct in the log message, for instance |
Returns
Type | Description |
---|---|
bool | True if successful |
WriteProperty(ref UnsafeText, string, UIntPtr, ref ArgumentInfo)
Writes UIntPtr as a property
Declaration
public bool WriteProperty(ref UnsafeText output, string fieldName, UIntPtr p, ref ArgumentInfo currArgSlot)
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
string | fieldName | Name of the field that can be used by formatter |
UInt |
p | UIntPtr to write |
Argument |
currArgSlot | Hole that was used to describe the struct in the log message, for instance |
Returns
Type | Description |
---|---|
bool | True if successful |
WriteProperty(ref UnsafeText, string, PayloadHandle, ref LogMemoryManager, ref ArgumentInfo)
Writes UTF8 string in Payload
Declaration
public bool WriteProperty(ref UnsafeText output, string fieldName, PayloadHandle payload, ref LogMemoryManager memAllocator, ref ArgumentInfo currArgSlot)
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
string | fieldName | Name of the field that can be used by formatter |
Payload |
payload | PayloadHandle that contains UTF8 string to write |
Log |
memAllocator | Memory allocator that owns the payload handle |
Argument |
currArgSlot | Hole that was used to describe the struct in the log message, for instance |
Returns
Type | Description |
---|---|
bool | True if successful |
WriteProperty<T>(ref UnsafeText, string, in T, ref ArgumentInfo)
Writes UTF8 string as a property
Declaration
public bool WriteProperty<T>(ref UnsafeText output, string fieldName, in T fs, ref ArgumentInfo currArgSlot) where T : unmanaged, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
string | fieldName | Name of the field that can be used by formatter |
T | fs | UTF8 string to write |
Argument |
currArgSlot | Hole that was used to describe the struct in the log message, for instance |
Returns
Type | Description |
---|---|
bool | True if successful |
Type Parameters
Name | Description |
---|---|
T | Unmanaged UTF8 string |
WriteUTF8String(ref UnsafeText, byte*, int, ref ArgumentInfo)
Writes a UTF8 string
Declaration
public bool WriteUTF8String(ref UnsafeText output, byte* ptr, int lengthBytes, ref ArgumentInfo currArgSlot)
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | UnsafeText where to append the text representation |
byte* | ptr | Pointer to UTF8 string |
int | lengthBytes | Length of the UTF8 string in bytes |
Argument |
currArgSlot | Hole that was used to describe the struct in the log message, for instance |
Returns
Type | Description |
---|---|
bool | True if successful |