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
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 UnsafeText
Declaration
public static bool AppendStringAsPayloadHandle(ref UnsafeText output, PayloadHandle payloadHandle, ref LogMemoryManager memAllocator)
Parameters
Type | Name | Description |
---|---|---|
UnsafeText | output | UnsafeText append to |
PayloadHandle | payloadHandle | PayloadHandle that has the UTF8 string |
LogMemoryManager | memAllocator | LogMemoryManager that owns the PayloadHandle |
Returns
Type | Description |
---|---|
Boolean | True if append was successful |
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 : struct
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 |
BuildContextSpecialType(Boolean, 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 |
---|---|---|
Boolean | 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(Int16, 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 |
---|---|---|
Int16 | special_short | short to pack |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | Handle for the created data |
BuildContextSpecialType(Int32, 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 |
---|---|---|
Int32 | special_int | Integer to pack |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | Handle for the created data |
BuildContextSpecialType(Int64, 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 |
---|---|---|
Int64 | 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(Single, 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 |
---|---|---|
Single | special_float | Float to pack |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | Handle for the created data |
BuildContextSpecialType(UInt16, 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 |
---|---|---|
UInt16 | special_ushort | Ushort to pack |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | Handle for the created data |
BuildContextSpecialType(UInt32, 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 |
---|---|---|
UInt32 | special_uint | UInt to pack |
LogMemoryManager | memAllocator | Memory manager |
Returns
Type | Description |
---|---|
PayloadHandle | Handle for the created data |
BuildContextSpecialType(UInt64, 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 |
---|---|---|
UInt64 | 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 |
---|---|---|
Unity.Logging.Internal.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 |
BuildDecorators(ref LogController, ref LogContextWithDecorator)
Adds decorators to Unity.Logging.Internal.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 |
Unity.Logging.Internal.LogContextWithDecorator | payload | LogContextWithDecorator to add decorators to |
BuildDecorators(ref LogController, LogControllerScopedLock, ref FixedList4096Bytes<PayloadHandle>)
Adds decorators to Unity.Logging.Internal.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 |
Unity.Logging.Internal.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 Unity.Logging.Internal.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 |
Unity.Logging.Internal.LogControllerScopedLock | lock | Lock that controls logController's life time |
FixedList512Bytes<PayloadHandle> | handles | List of handles where to add decorators |
See Also
BuildMessage(Byte*, Int32, 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 |
Int32 | 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, Int32, 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 |
Int32 | 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 |
---|---|---|
Unity.Logging.Internal.NativeTextBurstWrapper | msg | Unity.Logging.Internal.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*, Int32, 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 |
Int32 | 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 | IUTF8Bytes, INativeList of byte |
CopyCollectionStringToPayloadBuffer<T>(in T, ref LogMemoryManager, Boolean, Boolean, Boolean)
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 |
Boolean | prependTypeId | If true - typeId will be added to payload |
Boolean | prependLength | If true - length in bytes will be added to payload |
Boolean | 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, Boolean, Boolean, Boolean)
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 |
Boolean | prependTypeId | If true - typeId will be added to payload |
Boolean | prependLength | If true - length in bytes will be added to payload |
Boolean | 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*, Int32, ref LogMemoryManager, Boolean, Boolean, Boolean)
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 |
Int32 | sourceLength | Length of data in bytes |
LogMemoryManager | memAllocator | MemoryManager where to allocate the PayloadHandle |
Boolean | prependTypeId | If true - typeId will be added to payload |
Boolean | prependLength | If true - length in bytes will be added to payload |
Boolean | 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 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 UnsafeText |
Returns
Type | Description |
---|---|
UnsafeText | UnsafeText that has UTF8 representation of source string |
CreateText__Unmanaged(Byte*, Int32, Allocator)
Creates 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 |
Int32 | utf8Length | UTF8 string's length in bytes |
Allocator | allocator | Allocator that should be used to allocate UnsafeText |
Returns
Type | Description |
---|---|
UnsafeText | 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 |