docs.unity3d.com
    Show / Hide Table of Contents

    Struct LogWriterUtils

    Parser logic

    Inherited Members
    ValueType.Equals(Object)
    ValueType.GetHashCode()
    ValueType.ToString()
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Namespace: Unity.Logging
    Syntax
    [BurstCompile]
    public struct LogWriterUtils

    Methods

    AddDecorateHandler(LogControllerScopedLock, LoggerManager.OutputWriterDecorateHandler, Boolean)

    Used by Log.To().Decorate calls to add a method that's called for every log message, and adds decorations to it for a particular logger.

    Declaration
    public static LogDecorateHandlerScope AddDecorateHandler(LogControllerScopedLock lock, LoggerManager.OutputWriterDecorateHandler handler, bool isBurstable = false)
    Parameters
    Type Name Description
    Unity.Logging.Internal.LogControllerScopedLock lock

    LogControllerScopedLock of logger that adds the decorator

    Unity.Logging.Internal.LoggerManager.OutputWriterDecorateHandler handler

    Decorate call delegate

    Boolean isBurstable

    If true - BurstCompiler.CompileFunctionPointer will be called. Will fallback to false if compilation failed

    Returns
    Type Description
    Unity.Logging.Internal.LogDecorateHandlerScope

    LogDecorateHandlerScope scoped struct

    AddDecorateHandler(LoggerManager.OutputWriterDecorateHandler, Boolean)

    Used by Log.Decorate calls to add a method that's called for every log message, and add decorations to it globally.

    Declaration
    public static LogDecorateHandlerScope AddDecorateHandler(LoggerManager.OutputWriterDecorateHandler handler, bool isBurstable = false)
    Parameters
    Type Name Description
    Unity.Logging.Internal.LoggerManager.OutputWriterDecorateHandler handler

    Decorate call delegate

    Boolean isBurstable

    If true - BurstCompiler.CompileFunctionPointer will be called. Will fallback to false if compilation failed

    Returns
    Type Description
    Unity.Logging.Internal.LogDecorateHandlerScope

    LogDecorateHandlerScope scoped struct

    AddOutputHandler(LogWriterUtils.OutputWriterHandler, Boolean)

    Adds a delegate to process and generate logging output strings for a set of context structs.

    Declaration
    public static IntPtr AddOutputHandler(LogWriterUtils.OutputWriterHandler handler, bool isBurstable = false)
    Parameters
    Type Name Description
    LogWriterUtils.OutputWriterHandler handler

    LogWriterUtils.OutputWriterHandler delegate to output logging context struct data.

    Boolean isBurstable

    True to Burst compile the handler and false if it's not Burst compatible.

    Returns
    Type Description
    IntPtr

    A token referencing this handler, used for removing the handler later.

    Remarks

    This method is invoked by source generated code and generally shouldn't be used directly.

    Since this method takes a delegate parameter, it's not Burst compatible itself. However, the method referenced by the delegate can be Burst compatible or not, depending on how it's implemented. If the handler method is Burst compatible, then pass true for isBurstable to Burst compile the handler, otherwise the handler always runs as managed code.

    RemoveOutputHandler(IntPtr)

    Removes an LogWriterUtils.OutputWriterHandler delegate from the parser.

    Declaration
    public static void RemoveOutputHandler(IntPtr token)
    Parameters
    Type Name Description
    IntPtr token

    Value returned by a previous call to AddOutputHandler(LogWriterUtils.OutputWriterHandler, Boolean) for the handler to remove.

    Remarks

    This method is invoked by source generated code and generally shouldn't be used directly.

    Once the handler is removed, context structs this handler serviced will no longer generated logging output. Log message that reference these context structs will still be outputted, but the context data will be missing.

    SetOutputHandlerForLevel(LogWriterUtils.OutputWriterLevelHandler, Boolean)

    Sets a delegate to process and generate logging output strings for LogLevel.

    Declaration
    public static void SetOutputHandlerForLevel(LogWriterUtils.OutputWriterLevelHandler handler, bool isBurstable = false)
    Parameters
    Type Name Description
    LogWriterUtils.OutputWriterLevelHandler handler

    LogWriterUtils.OutputWriterLevelHandler delegate to output logging for LogLevel.

    Boolean isBurstable

    True to Burst compile the handler and false if it's not Burst compatible.

    Remarks

    This method is invoked by source generated code and generally shouldn't be used directly.

    Since this method takes a delegate parameter, it's not Burst compatible itself. However, the method referenced by the delegate can be Burst compatible or not, depending on how it's implemented. If the handler method is Burst compatible, then pass true for isBurstable to Burst compile the handler, otherwise the handler always runs as managed code.

    SetOutputHandlerForTimestamp(LogWriterUtils.OutputWriterTimestampHandler, Boolean)

    Sets a delegate to process and generate logging output strings for timestamps.

    Declaration
    public static void SetOutputHandlerForTimestamp(LogWriterUtils.OutputWriterTimestampHandler handler, bool isBurstable = false)
    Parameters
    Type Name Description
    LogWriterUtils.OutputWriterTimestampHandler handler

    LogWriterUtils.OutputWriterTimestampHandler delegate to output logging for timestamps.

    Boolean isBurstable

    True to Burst compile the handler and false if it's not Burst compatible.

    Remarks

    This method is invoked by source generated code and generally shouldn't be used directly.

    Since this method takes a delegate parameter, it's not Burst compatible itself. However, the method referenced by the delegate can be Burst compatible or not, depending on how it's implemented. If the handler method is Burst compatible, then pass true for isBurstable to Burst compile the handler, otherwise the handler always runs as managed code.

    WriteFormattedContextData(ref FormatterStruct, in PayloadHandle, ref UnsafeText, ref FixedString512Bytes, ref LogMemoryManager, ref ArgumentInfo)

    Appends string representation of a binary data in the payload

    Declaration
    public static bool WriteFormattedContextData(ref FormatterStruct formatter, in PayloadHandle payload, ref UnsafeText messageOutput, ref FixedString512Bytes errorMessage, ref LogMemoryManager memAllocator, ref ArgumentInfo currArgSlot)
    Parameters
    Type Name Description
    FormatterStruct formatter

    Current formatter

    PayloadHandle payload

    PayloadHandle that points to the binary data

    UnsafeText messageOutput

    UnsafeText where to append

    FixedString512Bytes errorMessage

    Returns an error message string, should a problem parsing the message occur.

    LogMemoryManager memAllocator

    Memory manager that holds binary representation of the mirror struct

    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 on success

    WriteFormattedLevel(LogLevel, ref UnsafeText)

    Appends string representation of LogLevel into UnsafeText

    Declaration
    public static bool WriteFormattedLevel(LogLevel level, ref UnsafeText messageOutput)
    Parameters
    Type Name Description
    LogLevel level

    Level to append

    UnsafeText messageOutput

    Where to append

    Returns
    Type Description
    Boolean

    True on success

    WriteFormattedTimestamp(in Int64, ref UnsafeText)

    Writes Timestamp to the UnsafeText as UTC

    Declaration
    public static bool WriteFormattedTimestamp(in long timestamp, ref UnsafeText messageOutput)
    Parameters
    Type Name Description
    Int64 timestamp

    Timestamp to write

    UnsafeText messageOutput

    Where to write to

    Returns
    Type Description
    Boolean

    True on success

    WriteFormattedTimestampLocalTimeZone(in Int64, ref UnsafeText)

    Writes Timestamp to the UnsafeText in Local time zone

    Declaration
    public static bool WriteFormattedTimestampLocalTimeZone(in long timestamp, ref UnsafeText messageOutput)
    Parameters
    Type Name Description
    Int64 timestamp

    Timestamp to write

    UnsafeText messageOutput

    Where to write to

    Returns
    Type Description
    Boolean

    True on success

    WriteFormattedTimestampLocalTimeZoneForConsole(in Int64, ref UnsafeText)

    Writes Timestamp to the UnsafeText in Local time zone to show in the Console Window in the Editor (HH:MM:SS)

    Declaration
    public static bool WriteFormattedTimestampLocalTimeZoneForConsole(in long timestamp, ref UnsafeText messageOutput)
    Parameters
    Type Name Description
    Int64 timestamp

    Timestamp to write

    UnsafeText messageOutput

    Where to write to

    Returns
    Type Description
    Boolean

    True on success

    WriteNewLine(ref UnsafeText)

    Appends a new line into the UnsafeText

    Declaration
    public static bool WriteNewLine(ref UnsafeText messageOutput)
    Parameters
    Type Name Description
    UnsafeText messageOutput

    UnsafeText to append the new line

    Returns
    Type Description
    Boolean

    True on success

    WriteProperties(ref UnsafeText)

    Appends all properties into the UnsafeText. For now not implemented

    Declaration
    public static bool WriteProperties(ref UnsafeText messageOutput)
    Parameters
    Type Name Description
    UnsafeText messageOutput

    UnsafeText to append the new line

    Returns
    Type Description
    Boolean

    True on success

    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