Struct Builder
Helper struct that helps pack data into LogMemoryManager Will be extended by Source Generator (that's why it is partial)
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 |
---|---|
SharedStatic<FixedString32Bytes> |
Methods
AppendStringAsPayloadHandle(ref UnsafeText, PayloadHandle, ref LogMemoryManager)
Appends data from PayloadHandle as UTF8 string into Unity.Collections.LowLevel.Unsafe.UnsafeText
Declaration
public static bool AppendStringAsPayloadHandle(ref UnsafeText output, PayloadHandle payloadHandle, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
UnsafeText | output | Unity.Collections.LowLevel.Unsafe.UnsafeText append to |
PayloadHandle | payloadHandle | PayloadHandle that has the UTF8 string |
LogMemoryManager | memAllocator | LogMemoryManager that owns the PayloadHandle |
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 |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 |
---|---|---|
IntPtr | special_intptr | Byte to pack |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 |
---|---|---|
UIntPtr | special_uintptr | Byte to pack |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 |
---|---|---|
FixedString128Bytes | fixedString | FixedString to pack |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 |
---|---|---|
FixedString32Bytes | fixedString | FixedString to pack |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 |
---|---|---|
FixedString4096Bytes | fixedString | FixedString to pack |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 |
---|---|---|
FixedString512Bytes | fixedString | FixedString to pack |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 |
---|---|---|
FixedString64Bytes | fixedString | FixedString to pack |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 |
---|---|---|
UnsafeText | unsafeText | UnsafeText to pack |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 |
---|---|---|
NativeText | nativeText | NativeText to pack |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 |
---|---|---|
NativeTextBurstWrapper | nativeTextWrapper | NativeTextBurstWrapper to pack |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 |
---|---|---|
PayloadHandle | payloadHandle | PayloadHandle to pack |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | Handle for the created data |
Type Parameters
Name | Description |
---|---|
T | Structure type |
BuildDecorators(ref LogController, ref LogContextWithDecorator)
Adds decorators to LogContextWithDecorator payloads list
Declaration
public static void BuildDecorators(ref LogController logController, ref LogContextWithDecorator payload)
Parameters
Type | Name | Description |
---|---|---|
LogController | logController | LogController that owns the decorators |
LogContextWithDecorator | payload | LogContextWithDecorator to add decorators to |
BuildDecorators(ref LogController, LogControllerScopedLock, ref FixedList4096Bytes<PayloadHandle>)
Adds decorators to LogContextWithDecorator payloads list
Declaration
public static void BuildDecorators(ref LogController logController, LogControllerScopedLock @lock, ref FixedList4096Bytes<PayloadHandle> handles)
Parameters
Type | Name | Description |
---|---|---|
LogController | logController | LogController that owns the decorators |
LogControllerScopedLock | lock | Lock that controls logController's life time |
FixedList4096Bytes<PayloadHandle> | handles | List of handles where to add decorators |
See Also
BuildDecorators(ref LogController, LogControllerScopedLock, ref FixedList512Bytes<PayloadHandle>)
Adds decorators to LogContextWithDecorator payloads list
Declaration
public static void BuildDecorators(ref LogController logController, LogControllerScopedLock @lock, ref FixedList512Bytes<PayloadHandle> handles)
Parameters
Type | Name | Description |
---|---|---|
LogController | logController | LogController that owns the decorators |
LogControllerScopedLock | lock | Lock that controls logController's life time |
FixedList512Bytes<PayloadHandle> | handles | List of handles where to add decorators |
See Also
BuildMessage(byte*, int, ref LogMemoryManager)
Writes UTF8 string into LogMemoryManager
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 |
LogMemoryManager | memAllocator | Memory allocator that should allocate the PayloadHandle and store the UTF8 string data |
Returns
Type | Description |
---|---|
PayloadHandle | PayloadHandle that contains the copied UTF8 string's data |
BuildMessage(IntPtr, int, ref LogMemoryManager)
Writes UTF8 string into LogMemoryManager
Declaration
public static PayloadHandle BuildMessage(IntPtr utf8Ptr, int utf8Length, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | utf8Ptr | IntPtr pointer to UTF8 string data |
int | utf8Length | Length of UTF8 string data |
LogMemoryManager | memAllocator | Memory allocator that should allocate the PayloadHandle and store the UTF8 string data |
Returns
Type | Description |
---|---|
PayloadHandle | PayloadHandle that contains the copied UTF8 string's data |
BuildMessage(string, ref LogMemoryManager)
Helper function to pack string into LogMemoryManager
Declaration
public static PayloadHandle BuildMessage(string message, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
string | message | Input message |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | Handle for the created data |
BuildMessage(NativeTextBurstWrapper, ref LogMemoryManager)
Writes UTF8 string into LogMemoryManager
Declaration
public static PayloadHandle BuildMessage(NativeTextBurstWrapper msg, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
NativeTextBurstWrapper | msg | NativeTextBurstWrapper nativeText wrapper that has UTF8 string |
LogMemoryManager | memAllocator | Memory allocator that should allocate the PayloadHandle and store the UTF8 string data |
Returns
Type | Description |
---|---|
PayloadHandle | PayloadHandle that contains the copied UTF8 string's data |
BuildMessage__Unmanaged(byte*, int, ref LogMemoryManager)
Helper function to pack generic T into LogMemoryManager
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 |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | 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 LogMemoryManager
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 |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | Handle for the created data |
Type Parameters
Name | Description |
---|---|
T | Unity.Collections.IUTF8Bytes, INativeList of byte |
CopyCollectionStringToPayloadBuffer<T>(in T, ref LogMemoryManager, bool, bool, bool)
Allocates memory in the LogMemoryManager and copies data into it with headers. Create copy of string message in UTF8 in PayloadBuffer, prepended with optional typeId and length
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 |
LogMemoryManager | memAllocator | MemoryManager where to allocate the PayloadHandle |
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 - PayloadHandle will be registered for deferred release (after 2 updates) |
Returns
Type | Description |
---|---|
PayloadHandle | PayloadHandle that holds the data |
Type Parameters
Name | Description |
---|---|
T | UTF8 collections string |
CopyStringToPayloadBuffer(string, ref LogMemoryManager, bool, bool, bool)
Allocates memory in the LogMemoryManager and copies data into it with headers.
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 |
LogMemoryManager | memAllocator | MemoryManager where to allocate the PayloadHandle |
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 - PayloadHandle will be registered for deferred release (after 2 updates) |
Returns
Type | Description |
---|---|
PayloadHandle | PayloadHandle that holds the data |
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 LogMemoryManager and copies data into it with headers.
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 |
LogMemoryManager | memAllocator | MemoryManager where to allocate the PayloadHandle |
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 - PayloadHandle will be registered for deferred release (after 2 updates) |
Returns
Type | Description |
---|---|
PayloadHandle | PayloadHandle that holds the data |
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 Unity.Collections.LowLevel.Unsafe.UnsafeText that has UTF8 representation of source string
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 Unity.Collections.LowLevel.Unsafe.UnsafeText |
Returns
Type | Description |
---|---|
UnsafeText | Unity.Collections.LowLevel.Unsafe.UnsafeText that has UTF8 representation of source string |
CreateText__Unmanaged(byte*, int, Allocator)
Creates Unity.Collections.LowLevel.Unsafe.UnsafeText that has UTF8 representation of source string When CreateText is called in the burst - CreateText__Unmanaged is called instead
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 Unity.Collections.LowLevel.Unsafe.UnsafeText |
Returns
Type | Description |
---|---|
UnsafeText | Unity.Collections.LowLevel.Unsafe.UnsafeText that has UTF8 representation of source string |
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 |
LogMemoryManager | memAllocator | Memory manager |
Type Parameters
Name | Description |
---|---|
T | INativeList of PayloadHandle |