Struct Builder
Helper struct that helps pack data into Log
Inherited Members
Namespace: Unity.Logging
Assembly: Unity.Logging.dll
Syntax
public struct Builder
Fields
EnvNewLine
FixedString32 that contains Environment.NewLine so Burst can read it
Declaration
public static readonly SharedStatic<FixedString32Bytes> EnvNewLine
Field Value
Type | Description |
---|---|
Shared |
Methods
AppendStringAsPayloadHandle(ref UnsafeText, PayloadHandle, ref LogMemoryManager)
Appends data from Payload
Declaration
public static bool AppendStringAsPayloadHandle(ref UnsafeText output, PayloadHandle payloadHandle, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
output | Unsafe |
Payload |
payloadHandle | Payload |
Log |
memAllocator | Log |
Returns
Type | Description |
---|---|
bool | True if append was successful |
BuildContextSpecialType(bool, ref LogMemoryManager)
Helper function to pack a special type of bool
Declaration
public static PayloadHandle BuildContextSpecialType(bool special_bool, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
bool | special_bool | bool to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildContextSpecialType(byte, ref LogMemoryManager)
Helper function to pack a special type of byte
Declaration
public static PayloadHandle BuildContextSpecialType(byte special_byte, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
byte | special_byte | Byte to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildContextSpecialType(char, ref LogMemoryManager)
Helper function to pack a special type of char
Declaration
public static PayloadHandle BuildContextSpecialType(char special_char, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
char | special_char | Char to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildContextSpecialType(decimal, ref LogMemoryManager)
Helper function to pack a special type of decimal
Declaration
public static PayloadHandle BuildContextSpecialType(decimal special_decimal, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
decimal | special_decimal | Decimal to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildContextSpecialType(double, ref LogMemoryManager)
Helper function to pack a special type of double
Declaration
public static PayloadHandle BuildContextSpecialType(double special_double, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
double | special_double | Double to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildContextSpecialType(short, ref LogMemoryManager)
Helper function to pack a special type of short
Declaration
public static PayloadHandle BuildContextSpecialType(short special_short, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
short | special_short | short to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildContextSpecialType(int, ref LogMemoryManager)
Helper function to pack a special type of int
Declaration
public static PayloadHandle BuildContextSpecialType(int special_int, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
int | special_int | Integer to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildContextSpecialType(long, ref LogMemoryManager)
Helper function to pack a special type of long
Declaration
public static PayloadHandle BuildContextSpecialType(long special_long, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
long | special_long | Long to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildContextSpecialType(IntPtr, ref LogMemoryManager)
Helper function to pack a special type of IntPtr
Declaration
public static PayloadHandle BuildContextSpecialType(IntPtr special_intptr, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
Int |
special_intptr | Byte to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildContextSpecialType(sbyte, ref LogMemoryManager)
Helper function to pack a special type of sbyte
Declaration
public static PayloadHandle BuildContextSpecialType(sbyte special_sbyte, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
sbyte | special_sbyte | sbyte to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildContextSpecialType(float, ref LogMemoryManager)
Helper function to pack a special type of float
Declaration
public static PayloadHandle BuildContextSpecialType(float special_float, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
float | special_float | Float to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildContextSpecialType(ushort, ref LogMemoryManager)
Helper function to pack a special type of ushort
Declaration
public static PayloadHandle BuildContextSpecialType(ushort special_ushort, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
ushort | special_ushort | Ushort to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildContextSpecialType(uint, ref LogMemoryManager)
Helper function to pack a special type of uint
Declaration
public static PayloadHandle BuildContextSpecialType(uint special_uint, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
uint | special_uint | UInt to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildContextSpecialType(ulong, ref LogMemoryManager)
Helper function to pack a special type of ulong
Declaration
public static PayloadHandle BuildContextSpecialType(ulong special_ulong, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
ulong | special_ulong | ULong to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildContextSpecialType(UIntPtr, ref LogMemoryManager)
Helper function to pack a special type of UIntPtr
Declaration
public static PayloadHandle BuildContextSpecialType(UIntPtr special_uintptr, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
UInt |
special_uintptr | Byte to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildContextSpecialType(FixedString128Bytes, ref LogMemoryManager)
Helper function to pack a FixedString
Declaration
public static PayloadHandle BuildContextSpecialType(FixedString128Bytes fixedString, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
Fixed |
fixedString | FixedString to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildContextSpecialType(FixedString32Bytes, ref LogMemoryManager)
Helper function to pack a FixedString
Declaration
public static PayloadHandle BuildContextSpecialType(FixedString32Bytes fixedString, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
Fixed |
fixedString | FixedString to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildContextSpecialType(FixedString4096Bytes, ref LogMemoryManager)
Helper function to pack a FixedString
Declaration
public static PayloadHandle BuildContextSpecialType(FixedString4096Bytes fixedString, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
Fixed |
fixedString | FixedString to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildContextSpecialType(FixedString512Bytes, ref LogMemoryManager)
Helper function to pack a FixedString
Declaration
public static PayloadHandle BuildContextSpecialType(FixedString512Bytes fixedString, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
Fixed |
fixedString | FixedString to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildContextSpecialType(FixedString64Bytes, ref LogMemoryManager)
Helper function to pack a FixedString
Declaration
public static PayloadHandle BuildContextSpecialType(FixedString64Bytes fixedString, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
Fixed |
fixedString | FixedString to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildContextSpecialType(UnsafeText, ref LogMemoryManager)
Helper function to pack an UnsafeText
Declaration
public static PayloadHandle BuildContextSpecialType(UnsafeText unsafeText, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
Unsafe |
unsafeText | UnsafeText to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildContextSpecialType(NativeText, ref LogMemoryManager)
Helper function to pack a NativeText
Declaration
public static PayloadHandle BuildContextSpecialType(NativeText nativeText, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
Native |
nativeText | NativeText to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildContextSpecialType(NativeTextBurstWrapper, ref LogMemoryManager)
Helper function to pack a NativeTextWrapper
Declaration
public static PayloadHandle BuildContextSpecialType(NativeTextBurstWrapper nativeTextWrapper, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
Native |
nativeTextWrapper | NativeTextBurstWrapper to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildContextSpecialType(PayloadHandle, ref LogMemoryManager)
Helper function to pack a string saved in a PayloadBuffer
Declaration
public static PayloadHandle BuildContextSpecialType(PayloadHandle payloadHandle, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
Payload |
payloadHandle | PayloadHandle to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildContext<T>(in T, ref LogMemoryManager)
Helper function to pack a struct
Declaration
public static PayloadHandle BuildContext<T>(in T structure, ref LogMemoryManager memAllocator) where T : unmanaged
Parameters
Type | Name | Description |
---|---|---|
T | structure | Struct to pack |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
Type Parameters
Name | Description |
---|---|
T | Structure type |
BuildDecorators(ref LogController, ref LogContextWithDecorator)
Adds decorators to Log
Declaration
public static void BuildDecorators(ref LogController logController, ref LogContextWithDecorator payload)
Parameters
Type | Name | Description |
---|---|---|
Log |
logController | LogController that owns the decorators |
Log |
payload | LogContextWithDecorator to add decorators to |
BuildDecorators(ref LogController, LogControllerScopedLock, ref FixedList4096Bytes<PayloadHandle>)
Adds decorators to Log
Declaration
public static void BuildDecorators(ref LogController logController, LogControllerScopedLock @lock, ref FixedList4096Bytes<PayloadHandle> handles)
Parameters
Type | Name | Description |
---|---|---|
Log |
logController | LogController that owns the decorators |
Log |
lock | Lock that controls logController's life time |
Fixed |
handles | List of handles where to add decorators |
See Also
BuildDecorators(ref LogController, LogControllerScopedLock, ref FixedList512Bytes<PayloadHandle>)
Adds decorators to Log
Declaration
public static void BuildDecorators(ref LogController logController, LogControllerScopedLock @lock, ref FixedList512Bytes<PayloadHandle> handles)
Parameters
Type | Name | Description |
---|---|---|
Log |
logController | LogController that owns the decorators |
Log |
lock | Lock that controls logController's life time |
Fixed |
handles | List of handles where to add decorators |
See Also
BuildMessage(byte*, int, ref LogMemoryManager)
Writes UTF8 string into Log
Declaration
public static PayloadHandle BuildMessage(byte* utf8Ptr, int utf8Length, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
byte* | utf8Ptr | Pointer to UTF8 string data |
int | utf8Length | Length of UTF8 string data |
Log |
memAllocator | Memory allocator that should allocate the Payload |
Returns
Type | Description |
---|---|
Payload |
Payload |
BuildMessage(IntPtr, int, ref LogMemoryManager)
Writes UTF8 string into Log
Declaration
public static PayloadHandle BuildMessage(IntPtr utf8Ptr, int utf8Length, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
Int |
utf8Ptr | IntPtr pointer to UTF8 string data |
int | utf8Length | Length of UTF8 string data |
Log |
memAllocator | Memory allocator that should allocate the Payload |
Returns
Type | Description |
---|---|
Payload |
Payload |
BuildMessage(string, ref LogMemoryManager)
Helper function to pack string into Log
Declaration
public static PayloadHandle BuildMessage(string message, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
string | message | Input message |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
BuildMessage(NativeTextBurstWrapper, ref LogMemoryManager)
Writes UTF8 string into Log
Declaration
public static PayloadHandle BuildMessage(NativeTextBurstWrapper msg, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
Native |
msg | Native |
Log |
memAllocator | Memory allocator that should allocate the Payload |
Returns
Type | Description |
---|---|
Payload |
Payload |
BuildMessage__Unmanaged(byte*, int, ref LogMemoryManager)
Helper function to pack generic T into Log
Declaration
[RequiredMember]
public static PayloadHandle BuildMessage__Unmanaged(byte* sourcePtr, int sourceLength, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
byte* | sourcePtr | Input message's ptr |
int | sourceLength | Input message's length in bytes |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
Remarks
When BuildMessage is called in Burst code, BuildMessage__Unmanaged is called instead
BuildMessage<T>(in T, ref LogMemoryManager)
Helper function to pack generic T into Log
Declaration
public static PayloadHandle BuildMessage<T>(in T message, ref LogMemoryManager memAllocator) where T : IUTF8Bytes, INativeList<byte>
Parameters
Type | Name | Description |
---|---|---|
T | message | Input message |
Log |
memAllocator | Memory manager |
Returns
Type | Description |
---|---|
Payload |
Handle for the created data |
Type Parameters
Name | Description |
---|---|
T | IUTF8Bytes, INativeList of byte |
CopyCollectionStringToPayloadBuffer<T>(in T, ref LogMemoryManager, bool, bool, bool)
Allocates memory in the Log
Declaration
public static PayloadHandle CopyCollectionStringToPayloadBuffer<T>(in T message, ref LogMemoryManager memAllocator, bool prependTypeId = false, bool prependLength = false, bool deferredRelease = false) where T : IUTF8Bytes, INativeList<byte>
Parameters
Type | Name | Description |
---|---|---|
T | message | UTF8 string to copy |
Log |
memAllocator | MemoryManager where to allocate the Payload |
bool | prependTypeId | If true - typeId will be added to payload |
bool | prependLength | If true - length in bytes will be added to payload |
bool | deferredRelease | If true - Payload |
Returns
Type | Description |
---|---|
Payload |
Payload |
Type Parameters
Name | Description |
---|---|
T | UTF8 collections string |
CopyStringToPayloadBuffer(string, ref LogMemoryManager, bool, bool, bool)
Allocates memory in the Log
Declaration
public static PayloadHandle CopyStringToPayloadBuffer(string source, ref LogMemoryManager memAllocator, bool prependTypeId = false, bool prependLength = false, bool deferredRelease = false)
Parameters
Type | Name | Description |
---|---|---|
string | source | String that stores the data in UTF16 |
Log |
memAllocator | MemoryManager where to allocate the Payload |
bool | prependTypeId | If true - typeId will be added to payload |
bool | prependLength | If true - length in bytes will be added to payload |
bool | deferredRelease | If true - Payload |
Returns
Type | Description |
---|---|
Payload |
Payload |
Remarks
Create a copy of string message in UTF8 in PayloadBuffer, prepended with optional typeId and length. When CopyStringToPayloadBuffer is called in the Burst code, CopyStringToPayloadBuffer__Unmanaged is called instead
CopyStringToPayloadBuffer__Unmanaged(byte*, int, ref LogMemoryManager, bool, bool, bool)
Allocates memory in the Log
Declaration
[RequiredMember]
public static PayloadHandle CopyStringToPayloadBuffer__Unmanaged(byte* sourcePtr, int sourceLength, ref LogMemoryManager memAllocator, bool prependTypeId = false, bool prependLength = false, bool deferredRelease = false)
Parameters
Type | Name | Description |
---|---|---|
byte* | sourcePtr | Pointer to data |
int | sourceLength | Length of data in bytes |
Log |
memAllocator | MemoryManager where to allocate the Payload |
bool | prependTypeId | If true - typeId will be added to payload |
bool | prependLength | If true - length in bytes will be added to payload |
bool | deferredRelease | If true - Payload |
Returns
Type | Description |
---|---|
Payload |
Payload |
Remarks
Create a copy of the string message in PayloadBuffer, prepended with optional typeId and length. When CopyStringToPayloadBuffer is called in Burst code, CopyStringToPayloadBuffer__Unmanaged is called instead.
CreateText(string, Allocator)
Creates Unsafe
Declaration
public static UnsafeText CreateText(string source, Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
string | source | UTF16 string |
Allocator | allocator | Allocator that should be used to allocate Unsafe |
Returns
Type | Description |
---|---|
Unsafe |
Unsafe |
CreateText__Unmanaged(byte*, int, Allocator)
Creates Unsafe
Declaration
[RequiredMember]
public static UnsafeText CreateText__Unmanaged(byte* utf8Ptr, int utf8Length, Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
byte* | utf8Ptr | UTF8 string pointer |
int | utf8Length | UTF8 string's length in bytes |
Allocator | allocator | Allocator that should be used to allocate Unsafe |
Returns
Type | Description |
---|---|
Unsafe |
Unsafe |
ForceReleasePayloads<T>(in T, ref LogMemoryManager)
Force release memory for payloads
Declaration
public static void ForceReleasePayloads<T>(in T payloadList, ref LogMemoryManager memAllocator) where T : INativeList<PayloadHandle>
Parameters
Type | Name | Description |
---|---|---|
T | payloadList | List of payloads |
Log |
memAllocator | Memory manager |
Type Parameters
Name | Description |
---|---|
T | INativeList of PayloadHandle |