docs.unity3d.com
    Show / Hide Table of Contents

    Struct FormatterStruct

    Inherited Members
    ValueType.Equals(Object)
    ValueType.GetHashCode()
    ValueType.ToString()
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Namespace: Unity.Logging
    Syntax
    public struct FormatterStruct : IFormatter

    Fields

    OnFormatMessage

    Converts a LogMessage into UnsafeText

    Declaration
    public OnLogMessageFormatterDelegate OnFormatMessage
    Field Value
    Type Description
    OnLogMessageFormatterDelegate

    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 readonly bool IsCreated { get; }
    Property Value
    Type Description
    Boolean
    Implements
    IFormatter.IsCreated

    UseText

    Checks if this is a JSON or text formatter

    Declaration
    public bool UseText { get; set; }
    Property Value
    Type Description
    Boolean

    Returns true if this is a text formatter, false if JSON

    Methods

    AfterObject(ref UnsafeText)

    Object ends. Should be called after BeforeObject(ref UnsafeText)

    Declaration
    public bool AfterObject(ref UnsafeText output)
    Parameters
    Type Name Description
    UnsafeText output

    UnsafeText where to append the text representation

    Returns
    Type Description
    Boolean

    True if successful

    Implements
    IFormatter.AfterObject(ref UnsafeText)

    AppendDelimiter(ref UnsafeText)

    Append a delimiter if any between properties / objects

    Declaration
    public bool AppendDelimiter(ref UnsafeText output)
    Parameters
    Type Name Description
    UnsafeText output

    UnsafeText where to append the text representation

    Returns
    Type Description
    Boolean

    True if successful

    Implements
    IFormatter.AppendDelimiter(ref UnsafeText)

    BeforeObject(ref UnsafeText)

    Object begins. Should be called before AfterObject(ref UnsafeText)

    Declaration
    public bool BeforeObject(ref UnsafeText output)
    Parameters
    Type Name Description
    UnsafeText output

    UnsafeText where to append the text representation

    Returns
    Type Description
    Boolean

    True if successful

    Implements
    IFormatter.BeforeObject(ref UnsafeText)

    BeginProperty(ref UnsafeText, String)

    Property starts. Should be called before EndProperty(ref UnsafeText, String)

    Declaration
    public bool BeginProperty(ref UnsafeText output, string fieldName)
    Parameters
    Type Name Description
    UnsafeText output

    UnsafeText where to append the text representation

    String fieldName

    Name of the field that can be used by formatter

    Returns
    Type Description
    Boolean

    True if successful

    Implements
    IFormatter.BeginProperty(ref UnsafeText, String)

    BeginProperty<T>(ref UnsafeText, ref T)

    Property starts. Should be called before EndProperty(ref UnsafeText, String)

    Declaration
    public bool BeginProperty<T>(ref UnsafeText output, ref T fieldName)
        where T : struct, IUTF8Bytes, INativeList<byte>
    Parameters
    Type Name Description
    UnsafeText output

    UnsafeText where to append the text representation

    T fieldName

    Name of the field that can be used by formatter

    Returns
    Type Description
    Boolean

    True if successful

    Type Parameters
    Name Description
    T

    Unmanaged UTF8 string

    Implements
    IFormatter.BeginProperty<T>(ref UnsafeText, ref T)

    EndProperty(ref UnsafeText, String)

    Property ends. Should be called after BeginProperty(ref UnsafeText, String)

    Declaration
    public bool EndProperty(ref UnsafeText output, string fieldName)
    Parameters
    Type Name Description
    UnsafeText output

    UnsafeText where to append the text representation

    String fieldName

    Name of the field that can be used by formatter

    Returns
    Type Description
    Boolean

    True if successful

    Implements
    IFormatter.EndProperty(ref UnsafeText, String)

    EndProperty<T>(ref UnsafeText, ref T)

    Property ends. Should be called after BeginProperty(ref UnsafeText, String)

    Declaration
    public bool EndProperty<T>(ref UnsafeText output, ref T fieldName)
        where T : struct, IUTF8Bytes, INativeList<byte>
    Parameters
    Type Name Description
    UnsafeText output

    UnsafeText where to append the text representation

    T fieldName

    Name of the field that can be used by formatter

    Returns
    Type Description
    Boolean

    True if successful

    Type Parameters
    Name Description
    T

    Unmanaged UTF8 string

    Implements
    IFormatter.EndProperty<T>(ref UnsafeText, ref T)

    WriteChild<T>(ref UnsafeText, String, ref T, ref LogMemoryManager, ref ArgumentInfo, Int32)

    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 : struct, ILoggableMirrorStruct
    Parameters
    Type Name Description
    UnsafeText 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

    LogMemoryManager memAllocator
    ArgumentInfo currArgSlot

    Hole that was used to describe the struct in the log message, for instance {0} or {Number} or {Number:##.0;-##.0}

    Int32 depth
    Returns
    Type Description
    Boolean

    True if successful

    Type Parameters
    Name Description
    T

    Child mirror struct - unmanaged, ILoggableMirrorStruct

    Implements
    IFormatter.WriteChild<T>(ref UnsafeText, String, ref T, ref LogMemoryManager, ref ArgumentInfo, Int32)

    WriteProperty(ref UnsafeText, String, Boolean, 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
    UnsafeText output

    UnsafeText where to append the text representation

    String fieldName

    Name of the field that can be used by formatter

    Boolean b

    Bool to write

    ArgumentInfo currArgSlot

    Hole that was used to describe the struct in the log message, for instance {0} or {Number} or {Number:##.0;-##.0}

    Returns
    Type Description
    Boolean

    True if successful

    Implements
    IFormatter.WriteProperty(ref UnsafeText, String, Boolean, ref ArgumentInfo)

    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
    UnsafeText 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

    ArgumentInfo currArgSlot

    Hole that was used to describe the struct in the log message, for instance {0} or {Number} or {Number:##.0;-##.0}

    Returns
    Type Description
    Boolean

    True if successful

    Implements
    IFormatter.WriteProperty(ref UnsafeText, String, Byte, ref ArgumentInfo)

    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
    UnsafeText 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

    ArgumentInfo currArgSlot

    Hole that was used to describe the struct in the log message, for instance {0} or {Number} or {Number:##.0;-##.0}

    Returns
    Type Description
    Boolean

    True if successful

    Implements
    IFormatter.WriteProperty(ref UnsafeText, String, Char, ref ArgumentInfo)

    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
    UnsafeText 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

    ArgumentInfo currArgSlot

    Hole that was used to describe the struct in the log message, for instance {0} or {Number} or {Number:##.0;-##.0}

    Returns
    Type Description
    Boolean

    True if successful

    Implements
    IFormatter.WriteProperty(ref UnsafeText, String, Decimal, ref ArgumentInfo)

    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
    UnsafeText 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

    ArgumentInfo currArgSlot

    Hole that was used to describe the struct in the log message, for instance {0} or {Number} or {Number:##.0;-##.0}

    Returns
    Type Description
    Boolean

    True if successful

    Implements
    IFormatter.WriteProperty(ref UnsafeText, String, Double, ref ArgumentInfo)

    WriteProperty(ref UnsafeText, String, Int16, 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
    UnsafeText output

    UnsafeText where to append the text representation

    String fieldName

    Name of the field that can be used by formatter

    Int16 c

    Short to write

    ArgumentInfo currArgSlot

    Hole that was used to describe the struct in the log message, for instance {0} or {Number} or {Number:##.0;-##.0}

    Returns
    Type Description
    Boolean

    True if successful

    Implements
    IFormatter.WriteProperty(ref UnsafeText, String, Int16, ref ArgumentInfo)

    WriteProperty(ref UnsafeText, String, Int32, 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
    UnsafeText output

    UnsafeText where to append the text representation

    String fieldName

    Name of the field that can be used by formatter

    Int32 c

    Int to write

    ArgumentInfo currArgSlot

    Hole that was used to describe the struct in the log message, for instance {0} or {Number} or {Number:##.0;-##.0}

    Returns
    Type Description
    Boolean

    True if successful

    Implements
    IFormatter.WriteProperty(ref UnsafeText, String, Int32, ref ArgumentInfo)

    WriteProperty(ref UnsafeText, String, Int64, 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
    UnsafeText output

    UnsafeText where to append the text representation

    String fieldName

    Name of the field that can be used by formatter

    Int64 c

    Long to write

    ArgumentInfo currArgSlot

    Hole that was used to describe the struct in the log message, for instance {0} or {Number} or {Number:##.0;-##.0}

    Returns
    Type Description
    Boolean

    True if successful

    Implements
    IFormatter.WriteProperty(ref UnsafeText, String, Int64, ref ArgumentInfo)

    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
    UnsafeText output

    UnsafeText where to append the text representation

    String fieldName

    Name of the field that can be used by formatter

    IntPtr p

    IntPtr to write

    ArgumentInfo currArgSlot

    Hole that was used to describe the struct in the log message, for instance {0} or {Number} or {Number:##.0;-##.0}

    Returns
    Type Description
    Boolean

    True if successful

    Implements
    IFormatter.WriteProperty(ref UnsafeText, String, IntPtr, ref ArgumentInfo)

    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
    UnsafeText 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

    ArgumentInfo currArgSlot

    Hole that was used to describe the struct in the log message, for instance {0} or {Number} or {Number:##.0;-##.0}

    Returns
    Type Description
    Boolean

    True if successful

    Implements
    IFormatter.WriteProperty(ref UnsafeText, String, SByte, ref ArgumentInfo)

    WriteProperty(ref UnsafeText, String, Single, 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
    UnsafeText output

    UnsafeText where to append the text representation

    String fieldName

    Name of the field that can be used by formatter

    Single c

    Primitive to write

    ArgumentInfo currArgSlot

    Hole that was used to describe the struct in the log message, for instance {0} or {Number} or {Number:##.0;-##.0}

    Returns
    Type Description
    Boolean

    True if successful

    Implements
    IFormatter.WriteProperty(ref UnsafeText, String, Single, ref ArgumentInfo)

    WriteProperty(ref UnsafeText, String, UInt16, 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
    UnsafeText output

    UnsafeText where to append the text representation

    String fieldName

    Name of the field that can be used by formatter

    UInt16 c

    UShort to write

    ArgumentInfo currArgSlot

    Hole that was used to describe the struct in the log message, for instance {0} or {Number} or {Number:##.0;-##.0}

    Returns
    Type Description
    Boolean

    True if successful

    Implements
    IFormatter.WriteProperty(ref UnsafeText, String, UInt16, ref ArgumentInfo)

    WriteProperty(ref UnsafeText, String, UInt32, 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
    UnsafeText output

    UnsafeText where to append the text representation

    String fieldName

    Name of the field that can be used by formatter

    UInt32 c

    UInt to write

    ArgumentInfo currArgSlot

    Hole that was used to describe the struct in the log message, for instance {0} or {Number} or {Number:##.0;-##.0}

    Returns
    Type Description
    Boolean

    True if successful

    Implements
    IFormatter.WriteProperty(ref UnsafeText, String, UInt32, ref ArgumentInfo)

    WriteProperty(ref UnsafeText, String, UInt64, 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
    UnsafeText output

    UnsafeText where to append the text representation

    String fieldName

    Name of the field that can be used by formatter

    UInt64 c

    ULong to write

    ArgumentInfo currArgSlot

    Hole that was used to describe the struct in the log message, for instance {0} or {Number} or {Number:##.0;-##.0}

    Returns
    Type Description
    Boolean

    True if successful

    Implements
    IFormatter.WriteProperty(ref UnsafeText, String, UInt64, ref ArgumentInfo)

    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
    UnsafeText output

    UnsafeText where to append the text representation

    String fieldName

    Name of the field that can be used by formatter

    UIntPtr p

    UIntPtr to write

    ArgumentInfo currArgSlot

    Hole that was used to describe the struct in the log message, for instance {0} or {Number} or {Number:##.0;-##.0}

    Returns
    Type Description
    Boolean

    True if successful

    Implements
    IFormatter.WriteProperty(ref UnsafeText, String, UIntPtr, ref ArgumentInfo)

    WriteProperty(ref UnsafeText, String, PayloadHandle, ref LogMemoryManager, ref ArgumentInfo)

    Writes UTF8 string in PayloadHandle as a property

    Declaration
    public bool WriteProperty(ref UnsafeText output, string fieldName, PayloadHandle payload, ref LogMemoryManager memAllocator, ref ArgumentInfo currArgSlot)
    Parameters
    Type Name Description
    UnsafeText output

    UnsafeText where to append the text representation

    String fieldName

    Name of the field that can be used by formatter

    PayloadHandle payload

    PayloadHandle that contains UTF8 string to write

    LogMemoryManager memAllocator

    Memory allocator that owns the payload handle

    ArgumentInfo currArgSlot

    Hole that was used to describe the struct in the log message, for instance {0} or {Number} or {Number:##.0;-##.0}

    Returns
    Type Description
    Boolean

    True if successful

    Implements
    IFormatter.WriteProperty(ref UnsafeText, String, PayloadHandle, ref LogMemoryManager, ref ArgumentInfo)

    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 : struct, INativeList<byte>, IUTF8Bytes
    Parameters
    Type Name Description
    UnsafeText 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

    ArgumentInfo currArgSlot

    Hole that was used to describe the struct in the log message, for instance {0} or {Number} or {Number:##.0;-##.0}

    Returns
    Type Description
    Boolean

    True if successful

    Type Parameters
    Name Description
    T

    Unmanaged UTF8 string

    Implements
    IFormatter.WriteProperty<T>(ref UnsafeText, String, in T, ref ArgumentInfo)

    WriteUTF8String(ref UnsafeText, Byte*, Int32, ref ArgumentInfo)

    Writes a UTF8 string

    Declaration
    public bool WriteUTF8String(ref UnsafeText output, byte *ptr, int lengthBytes, ref ArgumentInfo currArgSlot)
    Parameters
    Type Name Description
    UnsafeText output

    UnsafeText where to append the text representation

    Byte* ptr

    Pointer to UTF8 string

    Int32 lengthBytes

    Length of the UTF8 string in bytes

    ArgumentInfo currArgSlot

    Hole that was used to describe the struct in the log message, for instance {0} or {Number} or {Number:##.0;-##.0}

    Returns
    Type Description
    Boolean

    True if successful

    Implements
    IFormatter.WriteUTF8String(ref UnsafeText, Byte*, Int32, ref ArgumentInfo)
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023